foxygit / doom Log in
commit d676cd7af1ef6edb3c903f8b3c34ca67db7a0730
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sat Oct 27 18:05:04 2018 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sat Oct 27 18:05:04 2018 -0400

    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.
---
 src/CMakeLists.txt |  5 +++++
 src/i_glob.c       | 12 ++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 043c193b..252530e3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -93,6 +93,11 @@ set(GAME_SOURCE_FILES
     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
diff --git a/src/i_glob.c b/src/i_glob.c
index fb344e1a..f508eec7 100644
--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -16,16 +16,20 @@
 // to be interrogated.
 //

-// TODO: Merge win_opendir.[ch] into this file for MSVC implementation.
-
 #include <stdlib.h>

 #include "i_glob.h"
 #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
 {