mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[7488] Fixed map extractor on platforms with 2GB fopen() limit
This commit is contained in:
parent
a7fd57cc74
commit
071a24562a
2 changed files with 20 additions and 3 deletions
|
|
@ -16,7 +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;
|
||||
|
||||
typedef struct
|
||||
|
|
@ -81,9 +97,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue