1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-02-03 12:47:31 +01:00

Add function for getting the correct config directory on mac.

This commit is contained in:
John Maguire 2010-12-06 17:06:02 +00:00
parent 6406216918
commit d17703d39a
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,7 @@ void CheckForUpdates();
QString GetBundlePath();
QString GetResourcesPath();
QString GetApplicationSupportPath();
} // namespace mac

View File

@ -22,6 +22,7 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSTimer.h>
#import <Foundation/NSURL.h>
#import <AppKit/NSNibDeclarations.h>
@ -201,4 +202,16 @@ QString GetResourcesPath() {
return bundle_path + "/Contents/Resources";
}
QString GetApplicationSupportPath() {
NSArray* paths = NSSearchPathForDirectoriesInDomains(
NSApplicationSupportDirectory,
NSUserDomainMask,
YES);
if ([paths count] > 0) {
NSString* user_path = [paths objectAtIndex:0];
return QString::fromUtf8([user_path UTF8String]);
}
return "~/Library/Application Support";
}
} // namespace mac