(Linux and Unix) Made it possible to change the application data directory using the ESDE_APPDATA_DIR environment variable

This commit is contained in:
Leon Styhre 2024-03-10 14:56:19 +01:00
parent c514dc7748
commit 4260ecdbfc

View file

@ -252,7 +252,15 @@ namespace Utils
return getHomePath(); return getHomePath();
#else #else
if (FileSystemVariables::sAppDataDirectory.empty()) { if (FileSystemVariables::sAppDataDirectory.empty()) {
#if !defined(_WIN64)
if (getenv("ESDE_APPDATA_DIR") != nullptr) {
const std::string envAppDataDir {getenv("ESDE_APPDATA_DIR")};
FileSystemVariables::sAppDataDirectory = expandHomePath(envAppDataDir);
}
else if (Utils::FileSystem::exists(getHomePath() + "/ES-DE")) {
#else
if (Utils::FileSystem::exists(getHomePath() + "/ES-DE")) { if (Utils::FileSystem::exists(getHomePath() + "/ES-DE")) {
#endif
FileSystemVariables::sAppDataDirectory = getHomePath() + "/ES-DE"; FileSystemVariables::sAppDataDirectory = getHomePath() + "/ES-DE";
} }
else if (Utils::FileSystem::exists(getHomePath() + "/.emulationstation")) { else if (Utils::FileSystem::exists(getHomePath() + "/.emulationstation")) {