Merge pull request #1302 from fabiangreffrath/auto_organize_savefiles

enable "Organize save files" if no savegame found in old location
This commit is contained in:
Fabian Greffrath 2023-12-05 20:28:45 +01:00 committed by GitHub
commit aec003bb3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 22 deletions

View File

@ -2451,7 +2451,21 @@ void D_DoomMain(void)
PrintVersion();
if (!M_CheckParm("-save") && organize_savefiles)
if (!M_CheckParm("-save"))
{
if (organize_savefiles == -1)
{
// [FG] check for at least one savegame in the old location
glob_t *glob = I_StartMultiGlob(basesavegame,
GLOB_FLAG_NOCASE|GLOB_FLAG_SORTED,
"*.dsg", NULL);
organize_savefiles = (I_NextGlob(glob) == NULL);
I_EndGlob(glob);
}
if (organize_savefiles)
{
int i;
char *wadname = wadfiles[0], *oldsavegame = basesavegame;
@ -2480,6 +2494,7 @@ void D_DoomMain(void)
NormalizeSlashes(basesavegame);
M_MakeDirectory(basesavegame);
}
}
I_Printf(VB_INFO, "Savegame directory: %s\n", basesavegame);

View File

@ -626,7 +626,7 @@ default_t defaults[] = {
{
"organize_savefiles",
(config_t *) &organize_savefiles, NULL,
{0}, {0,1}, number, ss_gen, wad_no,
{-1}, {-1,1}, number, ss_gen, wad_no,
"1 to organize save files"
},