mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 12:02:48 +01:00
28 lines
584 B
Plaintext
28 lines
584 B
Plaintext
|
#include "spotify_utilities.h"
|
||
|
|
||
|
#import <Foundation/NSAutoreleasePool.h>
|
||
|
#import <Foundation/NSPathUtilities.h>
|
||
|
|
||
|
namespace utilities {
|
||
|
|
||
|
QString GetUserCacheDirectory() {
|
||
|
NSAutoreleasePool* pool = [NSAutoreleasePool alloc];
|
||
|
[pool init];
|
||
|
|
||
|
NSArray* paths = NSSearchPathForDirectoriesInDomains(
|
||
|
NSCachesDirectory,
|
||
|
NSUserDomainMask,
|
||
|
YES);
|
||
|
QString ret;
|
||
|
if ([paths count] > 0) {
|
||
|
NSString* user_path = [paths objectAtIndex:0];
|
||
|
ret = QString::fromUtf8([user_path UTF8String]);
|
||
|
} else {
|
||
|
ret = "~/Library/Caches";
|
||
|
}
|
||
|
[pool drain];
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
}
|