Apply srb2home to SAVECONFIG

This commit is contained in:
mazmazz 2018-12-13 13:17:56 -05:00
parent 93eda4e7c9
commit b1641aa8e9
1 changed files with 7 additions and 2 deletions

View File

@ -518,6 +518,7 @@ void M_FirstLoadConfig(void)
void M_SaveConfig(const char *filename) void M_SaveConfig(const char *filename)
{ {
FILE *f; FILE *f;
char *filepath;
// make sure not to write back the config until it's been correctly loaded // make sure not to write back the config until it's been correctly loaded
if (!gameconfig_loaded) if (!gameconfig_loaded)
@ -532,10 +533,14 @@ void M_SaveConfig(const char *filename)
return; return;
} }
f = fopen(filename, "w"); // append srb2home to beginning of filename
// configfile already has this applied
filepath = va(pandf,srb2home, filename);
f = fopen(filepath, "w");
// change it only if valid // change it only if valid
if (f) if (f)
strcpy(configfile, filename); strcpy(configfile, filepath);
else else
{ {
CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filename); CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filename);