@@ -164,7 +164,7 @@ gsl::owner<TextureFileStruct*> AddFile(TexEntry& entry, const bool compress, con
164164 return texture_file_struct;
165165}
166166
167- std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile (const std::string & modfile, const std::filesystem::path& dll_path, const bool compress)
167+ std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile (const std::filesystem::path & modfile, const std::filesystem::path& dll_path, const bool compress)
168168{
169169 const auto hr = CoInitializeEx (nullptr , COINIT_APARTMENTTHREADED);
170170 if (FAILED (hr)) return {};
@@ -192,25 +192,29 @@ std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile(const std::string& mo
192192
193193void TextureClient::LoadModsFromFile (const char * source)
194194{
195- static std::vector<std::string > loaded_modfiles{};
195+ static std::vector<std::filesystem::path > loaded_modfiles{};
196196 Message (" Initialize: searching in %s\n " , source);
197197
198- std::ifstream file (source);
198+ std::locale::global (std::locale (" " ));
199+ std::ifstream file (source, std::ios::binary);
199200 if (!file.is_open ()) {
200201 Warning (" LoadModsFromFile: failed to open modlist.txt for reading; aborting!!!" );
201202 return ;
202203 }
203204 Message (" Initialize: found modlist.txt. Reading\n " );
204205 std::string line;
205- std::vector<std::string > modfiles;
206+ std::vector<std::filesystem::path > modfiles;
206207 while (std::getline (file, line)) {
207208 // Remove newline character
208209 line.erase (std::ranges::remove (line, ' \r ' ).begin (), line.end ());
209210 line.erase (std::ranges::remove (line, ' \n ' ).begin (), line.end ());
210211
211- if (!std::ranges::contains (loaded_modfiles, line)) {
212- modfiles.push_back (line);
213- loaded_modfiles.push_back (line);
212+ const auto wline = utils::utf8_to_wstring (line);
213+ const auto fsline = std::filesystem::path (wline);
214+
215+ if (!std::ranges::contains (loaded_modfiles, fsline)) {
216+ modfiles.push_back (fsline);
217+ loaded_modfiles.push_back (fsline);
214218 }
215219 }
216220 auto files_size = 0u ;
0 commit comments