android: jni: config: Fix bug preventing creation of config.ini.

This commit is contained in:
bunnei 2019-07-20 13:41:00 -04:00 committed by xperia64
parent 501e6b414a
commit 1db5d7cf0e

View File

@ -30,12 +30,12 @@ Config::Config() {
Config::~Config() = default;
bool Config::LoadINI(const std::string& default_contents, bool retry) {
const char* location = this->sdl2_config_loc.c_str();
const std::string& location = this->sdl2_config_loc;
if (sdl2_config->ParseError() < 0) {
if (retry) {
LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location);
LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
FileUtil::CreateFullPath(location);
FileUtil::WriteStringToFile(true, default_contents, location);
FileUtil::WriteStringToFile(true, location, default_contents);
sdl2_config = std::make_unique<INIReader>(location); // Reopen file
return LoadINI(default_contents, false);
@ -43,7 +43,7 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
LOG_ERROR(Config, "Failed.");
return false;
}
LOG_INFO(Config, "Successfully loaded %s", location);
LOG_INFO(Config, "Successfully loaded {}", location);
return true;
}