mirror of https://github.com/bsnes-emu/bsnes.git
Use XDG base directories
This commit is contained in:
parent
d29677b778
commit
7a1d16bb3b
|
@ -90,7 +90,12 @@ inline auto userSettings() -> string {
|
||||||
#elif defined(PLATFORM_MACOS)
|
#elif defined(PLATFORM_MACOS)
|
||||||
string result = {Path::user(), "Library/Application Support/"};
|
string result = {Path::user(), "Library/Application Support/"};
|
||||||
#else
|
#else
|
||||||
string result = {Path::user(), ".config/"};
|
string result;
|
||||||
|
if(const char *env = getenv("XDG_CONFIG_HOME")) {
|
||||||
|
result = string(env);
|
||||||
|
} else {
|
||||||
|
result = {Path::user(), ".config/"};
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if(!result) result = ".";
|
if(!result) result = ".";
|
||||||
if(!result.endsWith("/")) result.append("/");
|
if(!result.endsWith("/")) result.append("/");
|
||||||
|
@ -109,7 +114,12 @@ inline auto userData() -> string {
|
||||||
#elif defined(PLATFORM_MACOS)
|
#elif defined(PLATFORM_MACOS)
|
||||||
string result = {Path::user(), "Library/Application Support/"};
|
string result = {Path::user(), "Library/Application Support/"};
|
||||||
#else
|
#else
|
||||||
string result = {Path::user(), ".local/share/"};
|
string result;
|
||||||
|
if(const char *env = getenv("XDG_DATA_HOME")) {
|
||||||
|
result = string(env);
|
||||||
|
} else {
|
||||||
|
result = {Path::user(), ".local/share/"};
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if(!result) result = ".";
|
if(!result) result = ".";
|
||||||
if(!result.endsWith("/")) result.append("/");
|
if(!result.endsWith("/")) result.append("/");
|
||||||
|
|
Loading…
Reference in New Issue