Convert waddir to an absolute path

Since we change directories to the waddir, if waddir is a relative path,
it will be invalidated after changing directories. Converting it to an
absolute path means we can change directories without messing anything
up.

Fixes #1310
This commit is contained in:
Jordan Christiansen 2024-11-06 19:59:58 -06:00
parent 987d2ee59a
commit 0a611b0f09
2 changed files with 4 additions and 0 deletions

View file

@ -1453,8 +1453,10 @@ const char *I_LocateWad(void)
{
// change to the directory where we found srb2.pk3
#if defined (_WIN32)
waddir = _fullpath(NULL, waddir, MAX_PATH);
SetCurrentDirectoryA(waddir);
#else
waddir = realpath(waddir, NULL);
if (chdir(waddir) == -1)
I_OutputMsg("Couldn't change working directory\n");
#endif

View file

@ -3087,8 +3087,10 @@ const char *I_LocateWad(void)
{
// change to the directory where we found srb2.pk3
#if defined (_WIN32)
waddir = _fullpath(NULL, waddir, MAX_PATH);
SetCurrentDirectoryA(waddir);
#else
waddir = realpath(waddir, NULL);
if (chdir(waddir) == -1)
I_OutputMsg("Couldn't change working directory\n");
#endif