mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Ensure directory exists to store user profile in
Create it if it doesn't exist. Also fix up the directory to be absolute instead of relative. Contributes to issue CURA-844.
This commit is contained in:
parent
c1a593c3d8
commit
d962cad347
1 changed files with 4 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import UM.VersionUpgrade #To indicate that a file is of incorrect format.
|
import UM.VersionUpgrade #To indicate that a file is of incorrect format.
|
||||||
import UM.VersionUpgradeManager #To schedule more files to be upgraded.
|
import UM.VersionUpgradeManager #To schedule more files to be upgraded.
|
||||||
|
import UM.Resources #To get the config storage path.
|
||||||
|
|
||||||
import configparser #To read config files.
|
import configparser #To read config files.
|
||||||
import io #To write config files to strings as if they were files.
|
import io #To write config files to strings as if they were files.
|
||||||
|
@ -108,8 +109,10 @@ class MachineInstance:
|
||||||
user_profile["values"] = {}
|
user_profile["values"] = {}
|
||||||
|
|
||||||
version_upgrade_manager = UM.VersionUpgradeManager.VersionUpgradeManager.getInstance()
|
version_upgrade_manager = UM.VersionUpgradeManager.VersionUpgradeManager.getInstance()
|
||||||
user_storage = next(iter(version_upgrade_manager.getStoragePaths("user")))
|
user_storage = os.path.join(UM.Resources.getDataStoragePath(), next(iter(version_upgrade_manager.getStoragePaths("user"))))
|
||||||
user_profile_file = os.path.join(user_storage, self._name + "_current_settings")
|
user_profile_file = os.path.join(user_storage, self._name + "_current_settings")
|
||||||
|
if not os.path.exists(user_storage):
|
||||||
|
os.makedirs(user_storage)
|
||||||
with open(user_profile_file, "w") as file_handle:
|
with open(user_profile_file, "w") as file_handle:
|
||||||
user_profile.write(file_handle)
|
user_profile.write(file_handle)
|
||||||
version_upgrade_manager.upgradeExtraFile(user_storage, self._name + "_current_settings", "user")
|
version_upgrade_manager.upgradeExtraFile(user_storage, self._name + "_current_settings", "user")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue