mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Added check to load custom filters set when present.
This commit is contained in:
parent
4e26a61db3
commit
184456892b
@ -8,10 +8,11 @@
|
||||
|
||||
#include "model/doc/document.hpp"
|
||||
#include "model/world/data.hpp"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
CS::Editor::Editor()
|
||||
: mDocumentManager (mCfgMgr), mViewManager (mDocumentManager)
|
||||
: mDocumentManager (mCfgMgr), mViewManager (mDocumentManager)
|
||||
{
|
||||
mIpcServerName = "org.openmw.OpenCS";
|
||||
|
||||
@ -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)
|
||||
|
@ -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_)
|
||||
: mSavePath (savePath), mContentFiles (files), mTools (mData), mResDir(resDir),
|
||||
: mSavePath (savePath), mContentFiles (files), mTools (mData), mResDir(resDir),
|
||||
mProjectPath ((configuration.getUserPath() / "projects") /
|
||||
(savePath.filename().string() + ".project")),
|
||||
mSaving (*this, mProjectPath)
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user