[pitivi: 3/8] Remove old presets files to allow creating preset directories



commit 6c2759c4529bd0861c5263e063bf1a02de2e92fc
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Thu Sep 15 10:36:10 2011 -0400

    Remove old presets files to allow creating preset directories

 pitivi/ui/preset.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/ui/preset.py b/pitivi/ui/preset.py
index 7796c8b..32dd2f8 100644
--- a/pitivi/ui/preset.py
+++ b/pitivi/ui/preset.py
@@ -84,6 +84,9 @@ class PresetManager(object):
 
     def saveAll(self):
         """Write changes to disk for all presets"""
+        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)
         for name, properties in self.ordered:
@@ -210,6 +213,9 @@ class PresetManager(object):
         """Update the preset values and write to disk"""
         if self.cur_preset != "No preset":
             self._updatePreset()
+            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]