From 3eaabb1b41869856bafc2e9b5926d95ba0d5bc68 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 25 May 2011 22:41:19 +0000 Subject: [PATCH] - some bugfixes discovered while testing in windows, related to files not found checking - Fixed debug project settings --- mk/windoze/glest_configurator.vcproj | 2 +- mk/windoze/xml2g.vcproj | 5 ++++- source/shared_lib/sources/util/properties.cpp | 9 ++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mk/windoze/glest_configurator.vcproj b/mk/windoze/glest_configurator.vcproj index 58a34b607..38427aadd 100644 --- a/mk/windoze/glest_configurator.vcproj +++ b/mk/windoze/glest_configurator.vcproj @@ -63,7 +63,7 @@ /> path= path; #if defined(WIN32) && !defined(__MINGW32__) - FILE *fp = _wfopen(utf8_decode(path).c_str(), L"r"); + wstring wstr = utf8_decode(path); + FILE *fp = _wfopen(wstr.c_str(), L"r"); ifstream fileStream(fp); #else ifstream fileStream; fileStream.open(path.c_str(), ios_base::in); #endif - if(fileStream.fail()){ + if(fileStream.is_open() == false){ if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str()); throw runtime_error("Can't open propertyMap file: " + path); } @@ -111,7 +112,9 @@ void Properties::load(const string &path, bool clearCurrentProperties) { fileStream.close(); #if defined(WIN32) && !defined(__MINGW32__) - fclose(fp); + if(fp) { + fclose(fp); + } #endif }