[vlc-commits] macosx: fix preferences reset if unknown version was found

David Fuhrmann git at videolan.org
Thu Nov 21 11:03:49 CET 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Nov 21 11:00:38 2013 +0100| [a87c668eaf2788a454f22a18b5dbd66f8750cd9d] | committer: David Fuhrmann

macosx: fix preferences reset if unknown version was found

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a87c668eaf2788a454f22a18b5dbd66f8750cd9d
---

 modules/gui/macosx/intf.m |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index d990c8a..96655ee 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1742,16 +1742,17 @@ static const int kCurrentPreferencesVersion = 3;
             return;
         }
 
-        NSArray * ourPreferences = [NSArray arrayWithObjects:@"org.videolan.vlc.plist", @"VLC", @"org.videolan.vlc", nil];
-
-        /* Move the file to trash so that user can find them later */
-        [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:preferences destination:nil files:ourPreferences tag:0];
-
-        /* really reset the defaults from now on */
-        [NSUserDefaults resetStandardUserDefaults];
+        // Do NOT add the current plist file here as this would conflict with caching.
+        // Instead, just reset below.
+        NSArray * ourPreferences = [NSArray arrayWithObjects:@"org.videolan.vlc", @"VLC", nil];
+
+        /* Move the file to trash one by one. Using above array the method would stop after first file
+           not found. */
+        for (NSString *file in ourPreferences) {
+            [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:preferences destination:@"" files:[NSArray arrayWithObject:file] tag:nil];
+        }
 
-        [defaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion];
-        [defaults synchronize];
+        [self resetAndReinitializeUserDefaults];
     }
 
     /* Relaunch now */



More information about the vlc-commits mailing list