Skip to content

Commit 98feeab

Browse files
committed
fix unicode path loading for spawns and houses
1 parent 9d3e2b4 commit 98feeab

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

source/iomap_otbm.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,11 @@ bool IOMapOTBM::loadSpawns(Map& map, const FileName& dir)
10791079
return false;
10801080
}
10811081

1082+
// has to be declared again as encoding-specific characters break loading there
1083+
std::string encoded_path = (const char*)(dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).mb_str(wxConvWhateverWorks));
1084+
encoded_path += map.spawnfile;
10821085
pugi::xml_document doc;
1083-
pugi::xml_parse_result result = doc.load_file(fn.c_str());
1086+
pugi::xml_parse_result result = doc.load_file(encoded_path.c_str());
10841087
if(!result) {
10851088
warnings.push_back("IOMapOTBM::loadSpawns: File loading error.");
10861089
return false;
@@ -1230,8 +1233,11 @@ bool IOMapOTBM::loadHouses(Map& map, const FileName& dir)
12301233
return false;
12311234
}
12321235

1236+
// has to be declared again as encoding-specific characters break loading there
1237+
std::string encoded_path = (const char*)(dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).mb_str(wxConvWhateverWorks));
1238+
encoded_path += map.housefile;
12331239
pugi::xml_document doc;
1234-
pugi::xml_parse_result result = doc.load_file(fn.c_str());
1240+
pugi::xml_parse_result result = doc.load_file(encoded_path.c_str());
12351241
if(!result) {
12361242
warnings.push_back("IOMapOTBM::loadHouses: File loading error.");
12371243
return false;

0 commit comments

Comments
 (0)