From 98cb238d36e0f85d9d4b4d2cff59c720e1630bdd Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Mon, 23 Dec 2019 17:43:42 -0800
Subject: [PATCH] Create directories from -logfile too

---
 src/sdl/i_main.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c
index 71b38841a1..70f5826764 100644
--- a/src/sdl/i_main.c
+++ b/src/sdl/i_main.c
@@ -158,10 +158,6 @@ int main(int argc, char **argv)
 		if (fileabs)
 		{
 			strftime(logfile, sizeof logfile, format, timeinfo);
-
-			M_MkdirEachUntil(logfile,
-					M_PathParts(logdir) - 1,
-					M_PathParts(logfile) - 1, 0755);
 		}
 		else
 		{
@@ -190,11 +186,13 @@ int main(int argc, char **argv)
 			}
 #endif/*LOGMESSAGES*/
 
-			M_MkdirEach(logfile, M_PathParts(logdir) - 1, 0755);
-
 			strftime(&logfile[left], sizeof logfile - left, format, timeinfo);
 		}
 
+		M_MkdirEachUntil(logfile,
+				M_PathParts(logdir) - 1,
+				M_PathParts(logfile) - 1, 0755);
+
 		logstream = fopen(logfile, "wt");
 	}
 
-- 
GitLab