Store configuration file in AppData root if not in working directory (#693)
* Store configuration file in AppData root if not in working directory This fixes MacOS app bundles, as the emulator cannot write the config file into the app bundle. * Remove duplicate fs calls * I'm an idiot sandwich --------- Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com>
This commit is contained in:
@@ -27,6 +27,7 @@ void EmulatorConfig::load() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Loading existing configuration file %s\n", path.string().c_str());
|
||||||
toml::value data;
|
toml::value data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -105,7 +105,13 @@ std::filesystem::path Emulator::getConfigPath() {
|
|||||||
if constexpr (Helpers::isAndroid()) {
|
if constexpr (Helpers::isAndroid()) {
|
||||||
return getAndroidAppPath() / "config.toml";
|
return getAndroidAppPath() / "config.toml";
|
||||||
} else {
|
} else {
|
||||||
return std::filesystem::current_path() / "config.toml";
|
std::filesystem::path localPath = std::filesystem::current_path() / "config.toml";
|
||||||
|
|
||||||
|
if (std::filesystem::exists(localPath)) {
|
||||||
|
return localPath;
|
||||||
|
} else {
|
||||||
|
return getAppDataRoot() / "config.toml";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user