CommonHostInterface: Fix -settings on cmdline not applying

This commit is contained in:
Connor McLaughlin 2021-03-12 03:02:57 +10:00
parent 14a98c3c9e
commit 7241876cc7
2 changed files with 10 additions and 14 deletions

View file

@ -56,6 +56,8 @@
Log_SetChannel(CommonHostInterface);
static std::string s_settings_filename;
CommonHostInterface::CommonHostInterface() = default;
CommonHostInterface::~CommonHostInterface() = default;
@ -367,7 +369,7 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[],
}
else if (CHECK_ARG_PARAM("-settings"))
{
m_settings_filename = argv[++i];
s_settings_filename = argv[++i];
continue;
}
else if (CHECK_ARG("--"))
@ -2367,18 +2369,13 @@ bool CommonHostInterface::SaveInputProfile(const char* profile_path)
std::string CommonHostInterface::GetSettingsFileName() const
{
if (!m_settings_filename.empty())
{
if (!FileSystem::FileExists(m_settings_filename.c_str()))
{
Log_ErrorPrintf("Could not find settings file %s, using default", m_settings_filename.c_str());
}
std::string filename;
if (!s_settings_filename.empty())
filename = s_settings_filename;
else
{
return GetUserDirectoryRelativePath(m_settings_filename.c_str());
}
}
return GetUserDirectoryRelativePath("settings.ini");
filename = GetUserDirectoryRelativePath("settings.ini");
return filename;
}
std::string CommonHostInterface::GetGameSaveStateFileName(const char* game_code, s32 slot) const

View file

@ -418,7 +418,6 @@ protected:
void DoFrameStep();
void DoToggleCheats();
std::string m_settings_filename;
std::unique_ptr<SettingsInterface> m_settings_interface;
std::recursive_mutex m_settings_mutex;