1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 10:39:39 +00:00

Added check to load custom filters set when present.

This commit is contained in:
Marek Kochanowicz 2013-10-19 18:43:47 +02:00
parent 4e26a61db3
commit 184456892b
2 changed files with 28 additions and 19 deletions

View file

@ -8,6 +8,7 @@
#include "model/doc/document.hpp"
#include "model/world/data.hpp"
#include <iostream>
CS::Editor::Editor()
@ -48,7 +49,7 @@ void CS::Editor::setupDataFiles()
("data-local", boost::program_options::value<std::string>()->default_value(""))
("fs-strict", boost::program_options::value<bool>()->implicit_value(true)->default_value(false))
("encoding", boost::program_options::value<std::string>()->default_value("win1252"))
("resources", boost::program_options::value<std::string>()->default_value("resources"), "set resources directory");
("resources", boost::program_options::value<std::string>()->default_value("resources"));
boost::program_options::notify(variables);
@ -88,7 +89,7 @@ void CS::Editor::setupDataFiles()
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
// Setting Resources directory.
// Adding Resources directory. First check if there is a file defaultfilters in the user path.
mDocumentManager.setResourceDir(variables["resources"].as<std::string>());
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)

View file

@ -2181,9 +2181,17 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, co
}
else
{
boost::filesystem::path filters = mResDir;
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath());
locCustomFiltersPath /= "defaultfilters.omwaddon.project";
if (boost::filesystem::exists(locCustomFiltersPath))
{
boost::filesystem::copy(locCustomFiltersPath, mProjectPath);
} else {
boost::filesystem::path filters(mResDir);
filters /= "defaultfilters.omwaddon.project";
boost::filesystem::copy_file(mResDir, mProjectPath);
boost::filesystem::copy_file(filters, mProjectPath);
}
getData().loadFile (mProjectPath, false, true);
}
}