mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-09 22:28:38 +01:00
Respect XDG_DATA_HOME
This commit is contained in:
parent
1f27bfd8a3
commit
1c19f418c6
1 changed files with 11 additions and 3 deletions
|
@ -408,9 +408,17 @@ std::string Local_Storage::get_user_appdata_path()
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
char *homedir = getenv("HOME");
|
/* $XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored.
|
||||||
if (homedir) {
|
If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. */
|
||||||
user_appdata_path = homedir;
|
char *datadir = getenv("XDG_DATA_HOME");
|
||||||
|
if (datadir) {
|
||||||
|
user_appdata_path = datadir;
|
||||||
|
} else {
|
||||||
|
char *homedir = getenv("HOME");
|
||||||
|
if (homedir) {
|
||||||
|
user_appdata_path = homedir;
|
||||||
|
user_appdata_path.append(PATH_SEPARATOR).append(".local").append(PATH_SEPARATOR).append("share");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return user_appdata_path.append(PATH_SEPARATOR).append(PROGRAM_NAME).append(" Saves");
|
return user_appdata_path.append(PATH_SEPARATOR).append(PROGRAM_NAME).append(" Saves");
|
||||||
|
|
Loading…
Reference in a new issue