mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Removed the hardcoded .emulationstation directory from Settings
This commit is contained in:
parent
b72e2a20a8
commit
79e12e0898
|
@ -363,8 +363,8 @@ void Settings::setDefaults()
|
||||||
void Settings::saveFile()
|
void Settings::saveFile()
|
||||||
{
|
{
|
||||||
LOG(LogDebug) << "Settings::saveFile(): Saving settings to es_settings.xml";
|
LOG(LogDebug) << "Settings::saveFile(): Saving settings to es_settings.xml";
|
||||||
const std::string path =
|
const std::filesystem::path path {
|
||||||
Utils::FileSystem::getHomePath() + "/.emulationstation/es_settings.xml";
|
Utils::FileSystem::getESDataDirectory().append("es_settings.xml")};
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
|
|
||||||
|
@ -383,9 +383,9 @@ void Settings::saveFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
doc.save_file(Utils::String::stringToWideString(path).c_str());
|
doc.save_file(Utils::String::stringToWideString(path.string()).c_str());
|
||||||
#else
|
#else
|
||||||
doc.save_file(path.c_str());
|
doc.save_file(path.string().c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Scripting::fireEvent("config-changed");
|
Scripting::fireEvent("config-changed");
|
||||||
|
@ -394,18 +394,18 @@ void Settings::saveFile()
|
||||||
|
|
||||||
void Settings::loadFile()
|
void Settings::loadFile()
|
||||||
{
|
{
|
||||||
const std::string configFile {Utils::FileSystem::getHomePath() +
|
std::filesystem::path configFile {
|
||||||
"/.emulationstation/es_settings.xml"};
|
Utils::FileSystem::getESDataDirectory().append("es_settings.xml")};
|
||||||
|
|
||||||
if (!Utils::FileSystem::exists(configFile))
|
if (!Utils::FileSystem::existsSTD(configFile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
pugi::xml_parse_result result {
|
pugi::xml_parse_result result {
|
||||||
doc.load_file(Utils::String::stringToWideString(configFile).c_str())};
|
doc.load_file(Utils::String::stringToWideString(configFile.string()).c_str())};
|
||||||
#else
|
#else
|
||||||
pugi::xml_parse_result result {doc.load_file(configFile.c_str())};
|
pugi::xml_parse_result result {doc.load_file(configFile.string().c_str())};
|
||||||
#endif
|
#endif
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOG(LogError) << "Couldn't parse the es_settings.xml file: " << result.description();
|
LOG(LogError) << "Couldn't parse the es_settings.xml file: " << result.description();
|
||||||
|
|
Loading…
Reference in a new issue