#If we haven't run it before, run the configuration wizard.
if profile.getMachineSetting('machine_type') == 'unknown':
- if platform.system() == "Windows":
- exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl'))
- else:
- #Check if we need to copy our examples
- exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.stl')
- if not os.path.isfile(exampleFile):
- try:
- os.makedirs(os.path.dirname(exampleFile))
- except:
- pass
- for filename in glob.glob(os.path.normpath(os.path.join(resources.resourceBasePath, 'example', '*.*'))):
- shutil.copy(filename, os.path.join(os.path.dirname(exampleFile), os.path.basename(filename)))
+ otherCuraInstalls = profile.getAlternativeBasePaths()
+ otherCuraInstalls.sort()
+ if len(otherCuraInstalls) > 0:
+ profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini'))
+ profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini'))
+ #Check if we need to copy our examples
+ exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl'))
+
self.loadFiles = [exampleFile]
if self.splash is not None:
self.splash.Show(False)
:return: The path in which the current configuration files are stored. This depends on the used OS.
"""
if platform.system() == "Windows":
- basePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
- #If we have a frozen python install, we need to step out of the library.zip
- if hasattr(sys, 'frozen'):
- basePath = os.path.normpath(os.path.join(basePath, ".."))
+ basePath = os.path.normpath(os.path.expanduser('~/.cura/%s' % version.getVersion(False)))
elif platform.system() == "Darwin":
basePath = os.path.expanduser('~/Library/Application Support/Cura/%s' % version.getVersion(False))
else:
path = os.path.join(basePath, subPath, 'Cura')
if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'preferences.ini')) and path != getBasePath():
paths.append(path)
+
+ #Check the old base path, which was in the application directory.
+ oldBasePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
+ basePath = os.path.normpath(os.path.join(oldBasePath, ".."))
+ for subPath in os.listdir(basePath):
+ path = os.path.join(basePath, subPath)
+ if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'preferences.ini')) and path != oldBasePath:
+ paths.append(path)
+ path = os.path.join(basePath, subPath, 'Cura')
+ if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'preferences.ini')) and path != oldBasePath:
+ paths.append(path)
+
return paths
def getDefaultProfilePath():