Index: main.cpp =================================================================== --- main.cpp (revision 828) +++ main.cpp (working copy) @@ -33,6 +33,7 @@ #include #include #include +#include using namespace Horde3D; using namespace std; @@ -85,6 +86,17 @@ return path; } +std::wstring widen( const std::string& in, std::locale loc = std::locale("") ) +{ + std::wstring out( in.length(), 0 ); + std::string::const_iterator i = in.begin(), ie = in.end(); + + for( std::wstring::iterator j = out.begin(); i!=ie; ++i, ++j ) + *j = std::use_facet< std::ctype< wchar_t > >( loc ).widen( *i ); + + return out; +} + } // namespace @@ -227,13 +239,15 @@ while( res != 0 ) { ifstream inf; - + // Loop over search paths and try to open files for( unsigned int i = 0; i < dirs.size(); ++i ) { string fileName = dirs[i] + resourcePaths[h3dGetResType( res )] + "/" + h3dGetResName( res ); + wstring lcFileName = widen( fileName ); // support for local charsets + inf.clear(); - inf.open( fileName.c_str(), ios::binary ); + inf.open( lcFileName.c_str(), ios::binary ); if( inf.good() ) break; }