diff options
author | Ghostkeeper <rubend@tutanota.com> | 2018-11-26 11:32:59 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2018-11-26 11:32:59 +0300 |
commit | c9eb57ceade38f567fc49f5e5ad0f6f1c8913d79 (patch) | |
tree | aefc28c310266c511c6df3660090e54d9a058243 /cura/Backups | |
parent | 8f9d6bee6243f32c9d966202e1f9a4ea5086b611 (diff) |
Don't copy preference file to the same location
This crashes Cura on start-up for some people.
Diffstat (limited to 'cura/Backups')
-rw-r--r-- | cura/Backups/Backup.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 897d5fa979..80681acb4f 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -46,12 +46,13 @@ class Backup: # We copy the preferences file to the user data directory in Linux as it's in a different location there. # When restoring a backup on Linux, we move it back. - if Platform.isLinux(): + if Platform.isLinux(): #TODO: This should check for the config directory not being the same as the data directory, rather than hard-coding that to Linux systems. preferences_file_name = self._application.getApplicationName() preferences_file = Resources.getPath(Resources.Preferences, "{}.cfg".format(preferences_file_name)) backup_preferences_file = os.path.join(version_data_dir, "{}.cfg".format(preferences_file_name)) - Logger.log("d", "Copying preferences file from %s to %s", preferences_file, backup_preferences_file) - shutil.copyfile(preferences_file, backup_preferences_file) + if not os.path.samefile(preferences_file, backup_preferences_file): + Logger.log("d", "Copying preferences file from %s to %s", preferences_file, backup_preferences_file) + shutil.copyfile(preferences_file, backup_preferences_file) # Create an empty buffer and write the archive to it. buffer = io.BytesIO() |