From f64ca47304b86291f75c31493a1494c58e335763 Mon Sep 17 00:00:00 2001 From: The Dax Date: Mon, 14 Oct 2013 02:10:47 -0400 Subject: [PATCH 1/2] Use wide paths on Win32. --- file/ini_file.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/file/ini_file.cpp b/file/ini_file.cpp index b5351a3751..9736f62e4d 100644 --- a/file/ini_file.cpp +++ b/file/ini_file.cpp @@ -20,6 +20,7 @@ #include "file/vfs.h" #ifdef _WIN32 +#include "../util/text/utf8.h" // Function Cross-Compatibility #define strcasecmp _stricmp #endif @@ -412,8 +413,9 @@ bool IniFile::Load(const char* filename) // Open file std::ifstream in; - in.open(filename, std::ios::in); - +#ifdef _WIN32 + in.open(ConvertUTF8ToWString(filename), std::ios::in); +#endif if (in.fail()) return false; bool success = Load(in); @@ -487,7 +489,11 @@ bool IniFile::Load(std::istream &in) { bool IniFile::Save(const char* filename) { std::ofstream out; +#ifdef _WIN32 + out.open(ConvertUTF8ToWString(filename), std::ios::out); +#else out.open(filename, std::ios::out); +#endif if (out.fail()) { @@ -521,7 +527,6 @@ bool IniFile::Save(const char* filename) return true; } - bool IniFile::Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue) { Section* section = GetSection(sectionName); From 1524cc37f5aae34fe66f9c7360df814506f73b31 Mon Sep 17 00:00:00 2001 From: The Dax Date: Mon, 14 Oct 2013 02:28:30 -0400 Subject: [PATCH 2/2] Oops. --- file/ini_file.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/file/ini_file.cpp b/file/ini_file.cpp index 9736f62e4d..e9e50b69f1 100644 --- a/file/ini_file.cpp +++ b/file/ini_file.cpp @@ -415,6 +415,8 @@ bool IniFile::Load(const char* filename) std::ifstream in; #ifdef _WIN32 in.open(ConvertUTF8ToWString(filename), std::ios::in); +#else + in.open(filename, std::ios::in); #endif if (in.fail()) return false;