1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Corrected filter template loading.

This commit is contained in:
Marek Kochanowicz 2013-11-13 11:38:29 +01:00
parent 08f8c93a71
commit 821d0c5c2d

View File

@ -2245,29 +2245,33 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, co
mData.setDescription (""); mData.setDescription ("");
mData.setAuthor (""); mData.setAuthor ("");
} }
/// \todo un-outcomment the else, once loading an existing content file works properly again. if (boost::filesystem::exists (mProjectPath))
{
std::cout<<"Loading file."<<std::endl;
getData().loadFile (mProjectPath, false, true);
}
else else
{ {
if (boost::filesystem::exists (mProjectPath)) std::cout<<"Attemp to use filters file as template."<<std::endl;
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath());
locCustomFiltersPath /= "defaultfilters";
if (boost::filesystem::exists(locCustomFiltersPath))
{ {
getData().loadFile (mProjectPath, false, true); std::cout<<"Found custom filters file ("<<locCustomFiltersPath<<")."<<std::endl;
} boost::filesystem::copy_file (locCustomFiltersPath, mProjectPath);
else } else {
{ boost::filesystem::path filters(mResDir);
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath()); filters /= "defaultfilters";
locCustomFiltersPath /= "defaultfilters"; std::cout<<"Attempt to read defaultfilters from: "<<filters<<std::endl;
if (boost::filesystem::exists(locCustomFiltersPath)) if (boost::filesystem::exists(filters))
{ {
boost::filesystem::copy_file (locCustomFiltersPath, mProjectPath);
} else {
boost::filesystem::path filters(mResDir);
filters /= "defaultfilters";
boost::filesystem::copy_file(filters, mProjectPath); boost::filesystem::copy_file(filters, mProjectPath);
} else {
std::cout<<filters<<" could not be found!"<<std::endl;
} }
getData().loadFile (mProjectPath, false, true); getData().loadFile (mProjectPath, false, true);
} }
} }
addOptionalGmsts(); addOptionalGmsts();
addOptionalGlobals(); addOptionalGlobals();