mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 10:54:01 +02:00
- bugfixes on windows platform when some folders and files are missing, do not crash hard.
This commit is contained in:
@@ -1470,7 +1470,7 @@ void CoreData::saveGameSettingsToFile(std::string fileName, GameSettings *gameSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
@@ -200,7 +200,7 @@ string MenuStateAbout::loadAdditionalCredits(){
|
|||||||
std::cout << buffer << std::endl;
|
std::cout << buffer << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@@ -171,14 +171,14 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
|
|||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -223,14 +223,14 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
|
|||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,7 @@ T* FileReader<T>::read(const string& filepath) const {
|
|||||||
T* ret = read(file,filepath);
|
T* ret = read(file,filepath);
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -393,7 +393,7 @@ T* FileReader<T>::read(const string& filepath, T* object) const {
|
|||||||
T* ret = read(file,filepath,object);
|
T* ret = read(file,filepath,object);
|
||||||
file.close();
|
file.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -883,7 +883,7 @@ void MapPreview::loadFromFile(const string &path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f1);
|
if(f1) fclose(f1);
|
||||||
|
|
||||||
fileLoaded = true;
|
fileLoaded = true;
|
||||||
mapFileLoaded = path;
|
mapFileLoaded = path;
|
||||||
@@ -964,7 +964,7 @@ void MapPreview::saveToFile(const string &path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f1);
|
if(f1) fclose(f1);
|
||||||
|
|
||||||
hasChanged = false;
|
hasChanged = false;
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ void AllocRegistry::dump(const char *path) {
|
|||||||
fprintf(f, "Total allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", allocCount, allocBytes);
|
fprintf(f, "Total allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", allocCount, allocBytes);
|
||||||
fprintf(f, "Not monitored allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", nonMonitoredCount, nonMonitoredBytes);
|
fprintf(f, "Not monitored allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", nonMonitoredCount, nonMonitoredBytes);
|
||||||
|
|
||||||
fclose(f);
|
if(f) fclose(f);
|
||||||
|
|
||||||
printf("Memory leak dump summary at: %s\n",szBuf2);
|
printf("Memory leak dump summary at: %s\n",szBuf2);
|
||||||
printf("Total leaks: %d, " MG_SIZE_T_SPECIFIER " bytes\n", leakCount, leakBytes);
|
printf("Total leaks: %d, " MG_SIZE_T_SPECIFIER " bytes\n", leakCount, leakBytes);
|
||||||
|
@@ -376,7 +376,7 @@ void Properties::save(const string &path){
|
|||||||
|
|
||||||
fileStream.close();
|
fileStream.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
fclose(fp);
|
if(fp) fclose(fp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user