COMMON: Restructuring how ApplicationSupport path is calculated and putting in Icons subdirectory
This commit is contained in:
parent
6ff9cde60c
commit
80cc43a1d2
3 changed files with 16 additions and 9 deletions
|
@ -262,18 +262,13 @@ Common::String OSystem_MacOSX::getDefaultLogFileName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String OSystem_MacOSX::getDefaultIconsPath() {
|
Common::String OSystem_MacOSX::getDefaultIconsPath() {
|
||||||
const char *prefix = getenv("HOME");
|
const Common::String defaultIconsPath = getAppSupportPathMacOSX() + "/Icons";
|
||||||
if (prefix == nullptr) {
|
|
||||||
|
if (!Posix::assureDirectoryExists(defaultIconsPath)) {
|
||||||
return Common::String();
|
return Common::String();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Common::String appSupportFolder = Common::String(prefix) + "/Library/Application Support/ScummVM";
|
return defaultIconsPath;
|
||||||
|
|
||||||
if (!Posix::assureDirectoryExists(appSupportFolder)) {
|
|
||||||
return Common::String();
|
|
||||||
}
|
|
||||||
|
|
||||||
return appSupportFolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String OSystem_MacOSX::getScreenshotsPath() {
|
Common::String OSystem_MacOSX::getScreenshotsPath() {
|
||||||
|
|
|
@ -30,5 +30,6 @@ Common::U32String getTextFromClipboardMacOSX();
|
||||||
bool setTextInClipboardMacOSX(const Common::U32String &text);
|
bool setTextInClipboardMacOSX(const Common::U32String &text);
|
||||||
Common::String getDesktopPathMacOSX();
|
Common::String getDesktopPathMacOSX();
|
||||||
Common::String getResourceAppBundlePathMacOSX();
|
Common::String getResourceAppBundlePathMacOSX();
|
||||||
|
Common::String getAppSupportPathMacOSX();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,3 +118,14 @@ Common::String getResourceAppBundlePathMacOSX() {
|
||||||
return Common::String();
|
return Common::String();
|
||||||
return Common::String([bundlePath fileSystemRepresentation]);
|
return Common::String([bundlePath fileSystemRepresentation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Common::String getAppSupportPathMacOSX() {
|
||||||
|
// See comments in getDesktopPathMacOSX() as we use the same methods
|
||||||
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||||
|
if ([paths count] == 0)
|
||||||
|
return Common::String();
|
||||||
|
NSString *path = [paths objectAtIndex:0];
|
||||||
|
if (path == nil)
|
||||||
|
return Common::String();
|
||||||
|
return Common::String([path fileSystemRepresentation]) + "/ScummVM";
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue