From d734d9a73f277a87707de2418266b209fd94285d Mon Sep 17 00:00:00 2001 From: Jordan Christiansen <xordspar0@gmail.com> Date: Wed, 6 Nov 2024 19:59:58 -0600 Subject: [PATCH] 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 --- src/dedicated/i_system.c | 2 ++ src/sdl/i_system.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 23c0149ca7..40d5a5ec3c 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -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); blah; if (chdir(waddir) == -1) I_OutputMsg("Couldn't change working directory\n"); #endif diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 9fe50a6a23..d8fb4346ba 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -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 -- GitLab