* Fixed extractor on systems with 2GB fopen() limit. Author: arrai

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2009-03-18 20:10:37 +01:00
parent 14f475d2ce
commit 5f2e9f1ed1

View File

@@ -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;
}