mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 20:06:41 +00:00
fixed handling of user directory defaultfilters file; some cleanup
This commit is contained in:
parent
821d0c5c2d
commit
68598f9b63
1 changed files with 15 additions and 9 deletions
|
@ -2245,33 +2245,39 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, co
|
||||||
mData.setDescription ("");
|
mData.setDescription ("");
|
||||||
mData.setAuthor ("");
|
mData.setAuthor ("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool filtersFound = false;
|
||||||
|
|
||||||
if (boost::filesystem::exists (mProjectPath))
|
if (boost::filesystem::exists (mProjectPath))
|
||||||
{
|
{
|
||||||
std::cout<<"Loading file."<<std::endl;
|
filtersFound = true;
|
||||||
getData().loadFile (mProjectPath, false, true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"Attemp to use filters file as template."<<std::endl;
|
|
||||||
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath());
|
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath());
|
||||||
locCustomFiltersPath /= "defaultfilters";
|
locCustomFiltersPath /= "defaultfilters";
|
||||||
|
|
||||||
if (boost::filesystem::exists(locCustomFiltersPath))
|
if (boost::filesystem::exists(locCustomFiltersPath))
|
||||||
{
|
{
|
||||||
std::cout<<"Found custom filters file ("<<locCustomFiltersPath<<")."<<std::endl;
|
|
||||||
boost::filesystem::copy_file (locCustomFiltersPath, mProjectPath);
|
boost::filesystem::copy_file (locCustomFiltersPath, mProjectPath);
|
||||||
} else {
|
filtersFound = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
boost::filesystem::path filters(mResDir);
|
boost::filesystem::path filters(mResDir);
|
||||||
filters /= "defaultfilters";
|
filters /= "defaultfilters";
|
||||||
std::cout<<"Attempt to read defaultfilters from: "<<filters<<std::endl;
|
|
||||||
if (boost::filesystem::exists(filters))
|
if (boost::filesystem::exists(filters))
|
||||||
{
|
{
|
||||||
boost::filesystem::copy_file(filters, mProjectPath);
|
boost::filesystem::copy_file(filters, mProjectPath);
|
||||||
} else {
|
filtersFound = true;
|
||||||
std::cout<<filters<<" could not be found!"<<std::endl;
|
|
||||||
}
|
}
|
||||||
getData().loadFile (mProjectPath, false, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filtersFound)
|
||||||
|
getData().loadFile (mProjectPath, false, true);
|
||||||
|
|
||||||
addOptionalGmsts();
|
addOptionalGmsts();
|
||||||
addOptionalGlobals();
|
addOptionalGlobals();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue