[vlc-commits] macosx: fix preferences reset if unknown version was found
David Fuhrmann
git at videolan.org
Fri Nov 22 21:36:51 CET 2013
vlc/vlc-2.1 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Nov 21 11:00:38 2013 +0100| [03612f91083033ecb0be6c218a673457288859b8] | committer: David Fuhrmann
macosx: fix preferences reset if unknown version was found
(cherry picked from commit a87c668eaf2788a454f22a18b5dbd66f8750cd9d)
Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=03612f91083033ecb0be6c218a673457288859b8
---
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 9322cff..59fb2e1 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1941,16 +1941,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