mirror of https://github.com/RPCS3/rpcs3.git
emu_settings: fix faulty custom config file creation
This commit is contained in:
parent
4c42043940
commit
eeb4d4d4de
|
@ -174,6 +174,8 @@ Render_Creator::Render_Creator()
|
||||||
|
|
||||||
emu_settings::emu_settings(const std::string& path) : QObject()
|
emu_settings::emu_settings(const std::string& path) : QObject()
|
||||||
{
|
{
|
||||||
|
m_path = path;
|
||||||
|
|
||||||
// Create config path if necessary
|
// Create config path if necessary
|
||||||
fs::create_path(fs::get_config_dir() + path);
|
fs::create_path(fs::get_config_dir() + path);
|
||||||
|
|
||||||
|
@ -185,9 +187,9 @@ emu_settings::emu_settings(const std::string& path) : QObject()
|
||||||
currentSettings += YAML::Load(config.to_string());
|
currentSettings += YAML::Load(config.to_string());
|
||||||
|
|
||||||
// Add game config
|
// Add game config
|
||||||
if (!path.empty())
|
if (!path.empty() && fs::is_file(fs::get_config_dir() + path + "/config.yml"))
|
||||||
{
|
{
|
||||||
config = fs::file(fs::get_config_dir() + path + "/config.yml", fs::read + fs::write + fs::create);
|
config = fs::file(fs::get_config_dir() + path + "/config.yml", fs::read + fs::write);
|
||||||
currentSettings += YAML::Load(config.to_string());
|
currentSettings += YAML::Load(config.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +202,12 @@ void emu_settings::SaveSettings()
|
||||||
{
|
{
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
emitData(out, currentSettings);
|
emitData(out, currentSettings);
|
||||||
|
|
||||||
|
if (!m_path.empty())
|
||||||
|
{
|
||||||
|
config = fs::file(fs::get_config_dir() + m_path + "/config.yml", fs::read + fs::write + fs::create);
|
||||||
|
}
|
||||||
|
|
||||||
// Save config
|
// Save config
|
||||||
config.seek(0);
|
config.seek(0);
|
||||||
config.trunc(0);
|
config.trunc(0);
|
||||||
|
|
|
@ -205,4 +205,5 @@ private:
|
||||||
|
|
||||||
YAML::Node currentSettings; // The current settings as a YAML node.
|
YAML::Node currentSettings; // The current settings as a YAML node.
|
||||||
fs::file config; //! File to read/write the config settings.
|
fs::file config; //! File to read/write the config settings.
|
||||||
|
std::string m_path;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue