mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Read data paths from data-local
section too
This commit is contained in:
parent
3b86f73ae7
commit
7e03dd0f12
2 changed files with 17 additions and 11 deletions
|
@ -859,6 +859,17 @@ std::vector<std::string>::iterator MwIniImporter::findString(std::vector<std::st
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwIniImporter::addPaths(std::vector<boost::filesystem::path>& output, std::vector<std::string> 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
|
void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, const boost::filesystem::path& iniFilename) const
|
||||||
{
|
{
|
||||||
std::vector<std::pair<std::time_t, boost::filesystem::path>> contentFiles;
|
std::vector<std::pair<std::time_t, boost::filesystem::path>> contentFiles;
|
||||||
|
@ -869,17 +880,11 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
|
||||||
|
|
||||||
std::vector<boost::filesystem::path> dataPaths;
|
std::vector<boost::filesystem::path> dataPaths;
|
||||||
if (cfg.count("data"))
|
if (cfg.count("data"))
|
||||||
{
|
addPaths(dataPaths, cfg["data"]);
|
||||||
for (std::string filePathString : cfg["data"])
|
|
||||||
{
|
if (cfg.count("data-local"))
|
||||||
if (filePathString.front() == '"')
|
addPaths(dataPaths, cfg["data-local"]);
|
||||||
{
|
|
||||||
filePathString.erase(filePathString.begin());
|
|
||||||
filePathString.erase(filePathString.end() - 1);
|
|
||||||
}
|
|
||||||
dataPaths.emplace_back(filePathString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dataPaths.push_back(iniFilename.parent_path() /= "Data Files");
|
dataPaths.push_back(iniFilename.parent_path() /= "Data Files");
|
||||||
|
|
||||||
multistrmap::const_iterator it = ini.begin();
|
multistrmap::const_iterator it = ini.begin();
|
||||||
|
|
|
@ -35,6 +35,7 @@ class MwIniImporter {
|
||||||
static std::vector<std::string>::iterator findString(std::vector<std::string>& source, const std::string& string);
|
static std::vector<std::string>::iterator findString(std::vector<std::string>& source, const std::string& string);
|
||||||
|
|
||||||
static void insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value);
|
static void insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value);
|
||||||
|
static void addPaths(std::vector<boost::filesystem::path>& output, std::vector<std::string> input);
|
||||||
|
|
||||||
/// \return file's "last modified time", used in original MW to determine plug-in load order
|
/// \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);
|
static std::time_t lastWriteTime(const boost::filesystem::path& filename, std::time_t defaultTime);
|
||||||
|
|
Loading…
Reference in a new issue