Skip to content

Commit

Permalink
windows: replacement for dirent.h and unistd.h
Browse files Browse the repository at this point in the history
  • Loading branch information
adynathos committed Oct 8, 2018
1 parent bdab761 commit b5e171f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "StormLib"]
path = StormLib
url = git://github.com/stormlib/StormLib.git
[submodule "dirent"]
path = dirent
url = git://github.com/tronkko/dirent.git
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ include_directories("${MPQEXTRACTOR_SOURCE_DIR}/StormLib/src/"
"${MPQEXTRACTOR_SOURCE_DIR}/include/"
)

# Replacement for dirent.h and unistd.h
if (WIN32)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/dirent/include")
endif()

add_executable(MPQExtractor main.cpp)
target_link_libraries(MPQExtractor storm)

Expand Down
1 change: 1 addition & 0 deletions dirent
Submodule dirent added at 65a555
11 changes: 9 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
#include <string>
#include <vector>
#include <algorithm>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <direct.h>
#include <dirent.h>
#ifdef WIN32
#include <io.h>
#define mkdir(dirname, acl) _mkdir(dirname)
#elif
#include <unistd.h>
#endif
#include <sys/stat.h>


Expand Down

0 comments on commit b5e171f

Please sign in to comment.