From 69ba055c2c537e89f434818543702c08a4d29851 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Thu, 31 Dec 2020 09:09:09 +0100 Subject: [PATCH] Minimal error checking for Sys_Mkdir() on windows. --- src/backends/windows/system.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) mode change 100755 => 100644 src/backends/windows/system.c diff --git a/src/backends/windows/system.c b/src/backends/windows/system.c old mode 100755 new mode 100644 index afa259fe..4a07ec62 --- a/src/backends/windows/system.c +++ b/src/backends/windows/system.c @@ -456,10 +456,16 @@ Sys_GetGameAPI(void *parms) void Sys_Mkdir(const char *path) { - WCHAR wpath[MAX_OSPATH] = {0}; - MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, MAX_OSPATH); + if (!Sys_IsDir(path)) + { + WCHAR wpath[MAX_OSPATH] = {0}; + MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, MAX_OSPATH); - CreateDirectoryW(wpath, NULL); + if (CreateDirectoryW(wpath, NULL) == 0) + { + Com_Error(ERR_FATAL, "Couldn't create dir %s\n", path); + } + } } qboolean