mirror of
https://github.com/thinkonmay/sunshine-sdk.git
synced 2025-12-27 15:45:41 +00:00
fix(linux)!: use XDG spec for fetching Linux configuration directory (#2034)
This commit is contained in:
parent
21e4450ee1
commit
2e995355dc
@ -99,12 +99,22 @@ namespace platf {
|
||||
|
||||
fs::path
|
||||
appdata() {
|
||||
const char *homedir;
|
||||
if ((homedir = getenv("HOME")) == nullptr) {
|
||||
homedir = getpwuid(geteuid())->pw_dir;
|
||||
const char *dir;
|
||||
|
||||
// May be set if running under a systemd service with the ConfigurationDirectory= option set.
|
||||
if ((dir = getenv("CONFIGURATION_DIRECTORY")) != nullptr) {
|
||||
return fs::path { dir } / "sunshine"sv;
|
||||
}
|
||||
// Otherwise, follow the XDG base directory specification:
|
||||
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
if ((dir = getenv("XDG_CONFIG_HOME")) != nullptr) {
|
||||
return fs::path { dir } / "sunshine"sv;
|
||||
}
|
||||
if ((dir = getenv("HOME")) == nullptr) {
|
||||
dir = getpwuid(geteuid())->pw_dir;
|
||||
}
|
||||
|
||||
return fs::path { homedir } / ".config/sunshine"sv;
|
||||
return fs::path { dir } / ".config/sunshine"sv;
|
||||
}
|
||||
|
||||
std::string
|
||||
|
||||
Loading…
Reference in New Issue
Block a user