mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-14 01:36:44 +00:00
Added check to load custom filters set when present.
This commit is contained in:
parent
4e26a61db3
commit
184456892b
2 changed files with 28 additions and 19 deletions
|
@ -8,10 +8,11 @@
|
||||||
|
|
||||||
#include "model/doc/document.hpp"
|
#include "model/doc/document.hpp"
|
||||||
#include "model/world/data.hpp"
|
#include "model/world/data.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
CS::Editor::Editor()
|
CS::Editor::Editor()
|
||||||
: mDocumentManager (mCfgMgr), mViewManager (mDocumentManager)
|
: mDocumentManager (mCfgMgr), mViewManager (mDocumentManager)
|
||||||
{
|
{
|
||||||
mIpcServerName = "org.openmw.OpenCS";
|
mIpcServerName = "org.openmw.OpenCS";
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ void CS::Editor::setupDataFiles()
|
||||||
("data-local", boost::program_options::value<std::string>()->default_value(""))
|
("data-local", boost::program_options::value<std::string>()->default_value(""))
|
||||||
("fs-strict", boost::program_options::value<bool>()->implicit_value(true)->default_value(false))
|
("fs-strict", boost::program_options::value<bool>()->implicit_value(true)->default_value(false))
|
||||||
("encoding", boost::program_options::value<std::string>()->default_value("win1252"))
|
("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);
|
boost::program_options::notify(variables);
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ void CS::Editor::setupDataFiles()
|
||||||
|
|
||||||
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
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>());
|
mDocumentManager.setResourceDir(variables["resources"].as<std::string>());
|
||||||
|
|
||||||
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
||||||
|
|
|
@ -2147,7 +2147,7 @@ void CSMDoc::Document::createBase()
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, bool new_)
|
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, bool new_)
|
||||||
: mSavePath (savePath), mContentFiles (files), mTools (mData), mResDir(resDir),
|
: mSavePath (savePath), mContentFiles (files), mTools (mData), mResDir(resDir),
|
||||||
mProjectPath ((configuration.getUserPath() / "projects") /
|
mProjectPath ((configuration.getUserPath() / "projects") /
|
||||||
(savePath.filename().string() + ".project")),
|
(savePath.filename().string() + ".project")),
|
||||||
mSaving (*this, mProjectPath)
|
mSaving (*this, mProjectPath)
|
||||||
|
@ -2181,9 +2181,17 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, co
|
||||||
}
|
}
|
||||||
else
|
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";
|
filters /= "defaultfilters.omwaddon.project";
|
||||||
boost::filesystem::copy_file(mResDir, mProjectPath);
|
boost::filesystem::copy_file(filters, mProjectPath);
|
||||||
|
}
|
||||||
|
getData().loadFile (mProjectPath, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue