[pitivi] preset: Rename early instead of delete old presets file



commit cd5c508cb697b7346b0ef2014774ff973fac523e
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu May 21 09:40:21 2015 +0200

    preset: Rename early instead of delete old presets file
    
    Differential Revision: https://phabricator.freedesktop.org/D361
    Reviewed-by: Thibault Saunier <tsaunier gnome org>

 pitivi/preset.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 82b384a..558fa26 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -82,6 +82,9 @@ class PresetManager(Loggable):
 
     def loadAll(self):
         self._loadFromDir(self.default_path)
+        if os.path.isfile(self.user_path):
+            # We used to save presets as a single file instead of a directory
+            os.rename(self.user_path, "%s.old" % self.user_path)
         self._loadFromDir(self.user_path)
 
     def _loadFromDir(self, presets_dir):
@@ -102,9 +105,6 @@ class PresetManager(Loggable):
 
     def savePreset(self, preset_name):
         assert preset_name != CUSTOM_PRESET_NAME
-        if os.path.isfile(self.user_path):
-            # We used to save presets as a single file instead of a directory
-            os.remove(self.user_path)
         if not os.path.exists(self.user_path):
             os.makedirs(self.user_path)
         try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]