aboutsummaryrefslogtreecommitdiff
path: root/contrib/extractor/System.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/extractor/System.cpp')
-rw-r--r--contrib/extractor/System.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp
index 75cc5ba92e4..afa2301e487 100644
--- a/contrib/extractor/System.cpp
+++ b/contrib/extractor/System.cpp
@@ -16,6 +16,23 @@
#include "loadlib/adt.h"
#include "loadlib/wdt.h"
+#include <fcntl.h>
+
+#if defined( __GNUC__ )
+ #define _open open
+ #define _close close
+ #ifndef O_BINARY
+ #define O_BINARY 0
+ #endif
+#else
+ #include <io.h>
+#endif
+
+#ifdef O_LARGEFILE
+ #define OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE)
+#else
+ #define OPEN_FLAGS (O_RDONLY | O_BINARY)
+#endif
extern ArchiveSet gOpenArchives;
@@ -81,9 +98,10 @@ void CreateDir( const std::string& Path )
bool FileExists( const char* FileName )
{
- if(FILE* fp = fopen( FileName, "rb" ))
+ int fp = _open(FileName, OPEN_FLAGS);
+ if(fp != -1)
{
- fclose(fp);
+ _close(fp);
return true;
}