[vlc-commits] macosx/prefs: replace use of API deprecated in 10.6
Felix Paul Kühne
git at videolan.org
Sun Feb 2 16:29:59 CET 2020
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri Jan 31 12:40:13 2020 +0100| [f513dc14dfe9ee3230206ca9f334d39d7156cd02] | committer: Felix Paul Kühne
macosx/prefs: replace use of API deprecated in 10.6
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f513dc14dfe9ee3230206ca9f334d39d7156cd02
---
modules/gui/macosx/main/VLCMain+OldPrefs.m | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/gui/macosx/main/VLCMain+OldPrefs.m b/modules/gui/macosx/main/VLCMain+OldPrefs.m
index ec4027686d..6fa8722e6b 100644
--- a/modules/gui/macosx/main/VLCMain+OldPrefs.m
+++ b/modules/gui/macosx/main/VLCMain+OldPrefs.m
@@ -105,8 +105,9 @@ static const int kCurrentPreferencesVersion = 4;
} else {
NSArray *libraries = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES);
- if (!libraries || [libraries count] == 0) return;
- NSString * preferences = [[libraries firstObject] stringByAppendingPathComponent:@"Preferences"];
+ if (!libraries || [libraries count] == 0)
+ return;
+ NSString *preferences = [[libraries firstObject] stringByAppendingPathComponent:@"Preferences"];
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSAlertStyleInformational];
@@ -122,15 +123,14 @@ static const int kCurrentPreferencesVersion = 4;
// 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];
- }
+ NSArray *ourPreferences = @[[[NSURL alloc] initFileURLWithPath:[preferences stringByAppendingPathComponent:@"org.videolan.vlc"]],
+ [[NSURL alloc] initFileURLWithPath:[preferences stringByAppendingPathComponent:@"VLC"]]];
- [self resetAndReinitializeUserDefaults];
+ [[NSWorkspace sharedWorkspace] recycleURLs:ourPreferences completionHandler:^(NSDictionary *newURLs, NSError *error){
+ [self resetAndReinitializeUserDefaults];
+ [VLCMain relaunchApplication];
+ }];
+ return;
}
[VLCMain relaunchApplication];
More information about the vlc-commits
mailing list