fix: initial config.cfg now gets created and dvar strings now get written correctly

This commit is contained in:
Jari van der Kaap 2023-02-18 20:19:09 +01:00
parent ad53d365d3
commit bba4efda62

View File

@ -41,7 +41,7 @@ namespace dvars
auto name = dvar->debugName; auto name = dvar->debugName;
auto value = game::Dvar_DisplayableValue(dvar); auto value = game::Dvar_DisplayableValue(dvar);
config_buffer.append(utils::string::va("set %s %s\n", name, value)); config_buffer.append(utils::string::va("set %s \"%s\"\n", name, value));
} }
if (config_buffer.length() == 0) if (config_buffer.length() == 0)
@ -65,7 +65,10 @@ namespace dvars
const std::string path = get_config_file_path(); const std::string path = get_config_file_path();
if (!utils::io::file_exists(path)) if (!utils::io::file_exists(path))
{
initial_config_read = true;
return; return;
}
std::string filedata; std::string filedata;
utils::io::read_file(path, &filedata); utils::io::read_file(path, &filedata);