implement mac OS X version of get desktop path
This commit is contained in:
parent
f72ce6de33
commit
bae3d1b036
|
@ -1,7 +1,35 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static void ensure_trailing_slash(std::string& path)
|
||||
{
|
||||
if (path.size() && path[path.size()-1] != '/') {
|
||||
path += "/";
|
||||
}
|
||||
}
|
||||
|
||||
static std::string get_desktop_dir()
|
||||
{
|
||||
std::string ret;
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES);
|
||||
NSString *path = [paths objectAtIndex: 0];
|
||||
|
||||
ret = [path fileSystemRepresentation];
|
||||
|
||||
[pool drain];
|
||||
|
||||
ensure_trailing_slash(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void Config::setupPaths()
|
||||
{
|
||||
|
||||
}
|
||||
desktopPath = get_desktop_dir();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue