Using NSFileManager to locate URL for Applications

This commit is contained in:
Michael Starke
2014-08-17 01:11:32 +02:00
parent c4ddfe8b3e
commit 030d97f4fc

View File

@@ -51,7 +51,8 @@
- (void)showCustomBrowserSelection:(id)sender {
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setDirectoryURL:[NSURL URLWithString:@"/Applications"]];
NSURL *applicationURL = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationDirectory inDomains:NSSystemDomainMask][0];
[openPanel setDirectoryURL:applicationURL];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];