mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 22:21:18 +02:00
- bugfixes so that the mingw compile builds
This commit is contained in:
@@ -370,7 +370,11 @@ bool isdir(const char *path)
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(__MINGW32__)
|
||||
struct _stat stats;
|
||||
#else
|
||||
struct _stat64i32 stats;
|
||||
#endif
|
||||
int result = _wstat(utf8_decode(friendly_path).c_str(), &stats);
|
||||
#else
|
||||
struct stat stats;
|
||||
@@ -1717,7 +1721,11 @@ bool renameFile(string oldFile, string newFile) {
|
||||
|
||||
off_t getFileSize(string filename) {
|
||||
#ifdef WIN32
|
||||
#if defined(__MINGW32__)
|
||||
struct _stat stbuf;
|
||||
#else
|
||||
struct _stat64i32 stbuf;
|
||||
#endif
|
||||
if(_wstat(utf8_decode(filename).c_str(), &stbuf) != -1) {
|
||||
#else
|
||||
struct stat stbuf;
|
||||
@@ -1873,7 +1881,7 @@ bool searchAndReplaceTextInFile(string fileName, string findText, string replace
|
||||
|
||||
void copyFileTo(string fromFileName, string toFileName) {
|
||||
//Open an input and output stream in binary mode
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
FILE *fp1 = _wfopen(utf8_decode(fromFileName).c_str(), L"rb");
|
||||
ifstream in(fp1);
|
||||
FILE *fp2 = _wfopen(utf8_decode(toFileName).c_str(), L"wb");
|
||||
@@ -1899,7 +1907,7 @@ void copyFileTo(string fromFileName, string toFileName) {
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
if(fp1) {
|
||||
fclose(fp1);
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
||||
size_t pos=0;
|
||||
this->path= path;
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
FILE *fp = _wfopen(utf8_decode(path).c_str(), L"r");
|
||||
ifstream fileStream(fp);
|
||||
#else
|
||||
@@ -110,7 +110,7 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
||||
}
|
||||
|
||||
fileStream.close();
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
@@ -269,7 +269,7 @@ bool Properties::applyTagsToValue(string &value, std::map<string,string> *mapTag
|
||||
}
|
||||
|
||||
void Properties::save(const string &path){
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
FILE *fp = _wfopen(utf8_decode(path).c_str(), L"w");
|
||||
ofstream fileStream(fp);
|
||||
#else
|
||||
@@ -284,7 +284,7 @@ void Properties::save(const string &path){
|
||||
}
|
||||
|
||||
fileStream.close();
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
|
@@ -513,7 +513,7 @@ void SystemFlags::logDebugEntry(DebugType type, string debugEntry, time_t debugT
|
||||
}
|
||||
|
||||
if(currentDebugLog.fileStream == NULL) {
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
currentDebugLog.fileStream = new std::ofstream(_wfopen(utf8_decode(debugLog).c_str(), L"w"));
|
||||
#else
|
||||
currentDebugLog.fileStream = new std::ofstream();
|
||||
|
Reference in New Issue
Block a user