android: jni: config: Fix bug preventing creation of config.ini.
This commit is contained in:
parent
7a5e441136
commit
219b65af1c
@ -30,12 +30,12 @@ Config::Config() {
|
|||||||
Config::~Config() = default;
|
Config::~Config() = default;
|
||||||
|
|
||||||
bool Config::LoadINI(const std::string& default_contents, bool retry) {
|
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 (sdl2_config->ParseError() < 0) {
|
||||||
if (retry) {
|
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::CreateFullPath(location);
|
||||||
FileUtil::WriteStringToFile(true, default_contents, location);
|
FileUtil::WriteStringToFile(true, location, default_contents);
|
||||||
sdl2_config = std::make_unique<INIReader>(location); // Reopen file
|
sdl2_config = std::make_unique<INIReader>(location); // Reopen file
|
||||||
|
|
||||||
return LoadINI(default_contents, false);
|
return LoadINI(default_contents, false);
|
||||||
@ -43,7 +43,7 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
|
|||||||
LOG_ERROR(Config, "Failed.");
|
LOG_ERROR(Config, "Failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOG_INFO(Config, "Successfully loaded %s", location);
|
LOG_INFO(Config, "Successfully loaded {}", location);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user