shithub: choc

Download patch

ref: d676cd7af1ef6edb3c903f8b3c34ca67db7a0730
parent: f01ac84ab3e2d38f977b0309f16da3644150e5aa
author: Simon Howard <[email protected]>
date: Sat Oct 27 14:05:04 EDT 2018

glob: Hook in win32 implementation for _MSC_VER.

I'm flying blind here so I don't know if this will actually work, but
I copied the cmake part from src/strife.

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -93,6 +93,11 @@
     w_merge.c           w_merge.h
     z_zone.c            z_zone.h)
 
+if(MSVC)
+    list(APPEND GAME_SOURCE_FILES
+         "../../win32/win_opendir.c" "../../win32/win_opendir.h")
+endif()
+
 set(DEHACKED_SOURCE_FILES
                         deh_defs.h
     deh_io.c            deh_io.h
--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -16,8 +16,6 @@
 // to be interrogated.
 //
 
-// TODO: Merge win_opendir.[ch] into this file for MSVC implementation.
-
 #include <stdlib.h>
 
 #include "i_glob.h"
@@ -24,8 +22,14 @@
 #include "m_misc.h"
 #include "config.h"
 
-#ifdef HAVE_DIRENT_H
-#include "dirent.h"
+// For Visual C++, we need to include the win_opendir module.
+#if defined(_MSC_VER)
+#include <win_opendir.h>
+#elif defined(HAVE_DIRENT_H)
+#include <dirent.h>
+#endif
+
+#if defined(_MSC_VER) || defined(HAVE_DIRENT_H)
 
 struct glob_s
 {