Skip to content

Commit

Permalink
Hexen: do not overwrite savedir config variable
Browse files Browse the repository at this point in the history
Fixes #96

Co-Authored-By: NightFright2k19 <54737241+NightFright2k19@users.noreply.github.com>
  • Loading branch information
JNechaevsky and NightFright2k19 committed Feb 17, 2024
1 parent a6c5960 commit 9713e7c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,9 +1223,20 @@ char *M_GetSaveGameDir(const char *iwadname)
else if (!strcmp(configdir, exedir))
{
#ifdef _WIN32
// [JN] Always use "savegames" folder in program folder.
savegamedir = M_StringJoin(M_StringDuplicate(exedir), "savegames", DIR_SEPARATOR_S, NULL);
M_MakeDirectory(savegamedir);
// [JN] Check if "savedir" variable is existing in config file.
const char *existing_path = M_GetStringVariable("savedir");

if (existing_path != NULL && strlen(existing_path) > 0)
{
// It exist, use it's provided path.
savegamedir = M_StringDuplicate("");
}
else
{
// Otherwise, create and use "savegames" folder in program folder.
savegamedir = M_StringJoin(M_StringDuplicate(exedir), "savegames", DIR_SEPARATOR_S, NULL);
}
M_MakeDirectory(savegamedir);
#else
savegamedir = M_StringDuplicate("");
#endif
Expand Down

0 comments on commit 9713e7c

Please sign in to comment.