diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 3433fe5c7d..6f5c2e2cdb 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -859,6 +859,17 @@ std::vector::iterator MwIniImporter::findString(std::vector& output, std::vector input) { + for (auto& path : input) { + if (path.front() == '"') + { + path.erase(path.begin()); + path.erase(path.end() - 1); + } + output.emplace_back(path); + } +} + void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, const boost::filesystem::path& iniFilename) const { std::vector> contentFiles; @@ -869,17 +880,11 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co std::vector dataPaths; if (cfg.count("data")) - { - for (std::string filePathString : cfg["data"]) - { - if (filePathString.front() == '"') - { - filePathString.erase(filePathString.begin()); - filePathString.erase(filePathString.end() - 1); - } - dataPaths.emplace_back(filePathString); - } - } + addPaths(dataPaths, cfg["data"]); + + if (cfg.count("data-local")) + addPaths(dataPaths, cfg["data-local"]); + dataPaths.push_back(iniFilename.parent_path() /= "Data Files"); multistrmap::const_iterator it = ini.begin(); diff --git a/apps/mwiniimporter/importer.hpp b/apps/mwiniimporter/importer.hpp index d99866533b..7b710a4a40 100644 --- a/apps/mwiniimporter/importer.hpp +++ b/apps/mwiniimporter/importer.hpp @@ -35,6 +35,7 @@ class MwIniImporter { static std::vector::iterator findString(std::vector& source, const std::string& string); static void insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value); + static void addPaths(std::vector& output, std::vector input); /// \return file's "last modified time", used in original MW to determine plug-in load order static std::time_t lastWriteTime(const boost::filesystem::path& filename, std::time_t defaultTime);