|
|
@ -173,12 +173,11 @@ public: |
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
#ifdef _WIN32
|
|
|
GenerateLegacyPath(EmuPath::RyujinxDir, GetAppDataRoamingDirectory() / RYUJINX_DIR); |
|
|
GenerateLegacyPath(EmuPath::RyujinxDir, GetAppDataRoamingDirectory() / RYUJINX_DIR); |
|
|
#else
|
|
|
|
|
|
|
|
|
#elif !defined(__OPENORBIS__)
|
|
|
// In Ryujinx's infinite wisdom, it places EVERYTHING in the config directory on UNIX
|
|
|
// In Ryujinx's infinite wisdom, it places EVERYTHING in the config directory on UNIX
|
|
|
// This is incredibly stupid and violates a million XDG standards, but whatever
|
|
|
// This is incredibly stupid and violates a million XDG standards, but whatever
|
|
|
GenerateLegacyPath(EmuPath::RyujinxDir, GetDataDirectory("XDG_CONFIG_HOME") / RYUJINX_DIR); |
|
|
GenerateLegacyPath(EmuPath::RyujinxDir, GetDataDirectory("XDG_CONFIG_HOME") / RYUJINX_DIR); |
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
@ -340,36 +339,33 @@ fs::path GetAppDataRoamingDirectory() { |
|
|
return fs_appdata_roaming_path; |
|
|
return fs_appdata_roaming_path; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#elif defined(__OPENORBIS__)
|
|
|
|
|
|
|
|
|
|
|
|
// Not required/defined
|
|
|
|
|
|
|
|
|
#else
|
|
|
#else
|
|
|
|
|
|
|
|
|
fs::path GetHomeDirectory() { |
|
|
fs::path GetHomeDirectory() { |
|
|
const char* home_env_var = getenv("HOME"); |
|
|
const char* home_env_var = getenv("HOME"); |
|
|
|
|
|
|
|
|
if (home_env_var) { |
|
|
if (home_env_var) { |
|
|
return fs::path{home_env_var}; |
|
|
return fs::path{home_env_var}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
LOG_INFO(Common_Filesystem, |
|
|
LOG_INFO(Common_Filesystem, |
|
|
"$HOME is not defined in the environment variables, " |
|
|
|
|
|
"attempting to query passwd to get the home path of the current user"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"$HOME is not defined in the environment variables, " |
|
|
|
|
|
"attempting to query passwd to get the home path of the current user"); |
|
|
const auto* pw = getpwuid(getuid()); |
|
|
const auto* pw = getpwuid(getuid()); |
|
|
|
|
|
|
|
|
if (!pw) { |
|
|
if (!pw) { |
|
|
LOG_ERROR(Common_Filesystem, "Failed to get the home path of the current user"); |
|
|
LOG_ERROR(Common_Filesystem, "Failed to get the home path of the current user"); |
|
|
return {}; |
|
|
return {}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return fs::path{pw->pw_dir}; |
|
|
return fs::path{pw->pw_dir}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fs::path GetDataDirectory(const std::string& env_name) { |
|
|
fs::path GetDataDirectory(const std::string& env_name) { |
|
|
const char* data_env_var = getenv(env_name.c_str()); |
|
|
const char* data_env_var = getenv(env_name.c_str()); |
|
|
|
|
|
|
|
|
if (data_env_var) { |
|
|
if (data_env_var) { |
|
|
return fs::path{data_env_var}; |
|
|
return fs::path{data_env_var}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (env_name == "XDG_DATA_HOME") { |
|
|
if (env_name == "XDG_DATA_HOME") { |
|
|
return GetHomeDirectory() / ".local/share"; |
|
|
return GetHomeDirectory() / ".local/share"; |
|
|
} else if (env_name == "XDG_CACHE_HOME") { |
|
|
} else if (env_name == "XDG_CACHE_HOME") { |
|
|
@ -377,7 +373,6 @@ fs::path GetDataDirectory(const std::string& env_name) { |
|
|
} else if (env_name == "XDG_CONFIG_HOME") { |
|
|
} else if (env_name == "XDG_CONFIG_HOME") { |
|
|
return GetHomeDirectory() / ".config"; |
|
|
return GetHomeDirectory() / ".config"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return {}; |
|
|
return {}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|