mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-03 13:45:32 +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.setAuthor ("");
|
||||
}
|
||||
|
||||
bool filtersFound = false;
|
||||
|
||||
if (boost::filesystem::exists (mProjectPath))
|
||||
{
|
||||
std::cout<<"Loading file."<<std::endl;
|
||||
getData().loadFile (mProjectPath, false, true);
|
||||
filtersFound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"Attemp to use filters file as template."<<std::endl;
|
||||
boost::filesystem::path locCustomFiltersPath (configuration.getUserPath());
|
||||
locCustomFiltersPath /= "defaultfilters";
|
||||
|
||||
if (boost::filesystem::exists(locCustomFiltersPath))
|
||||
{
|
||||
std::cout<<"Found custom filters file ("<<locCustomFiltersPath<<")."<<std::endl;
|
||||
boost::filesystem::copy_file (locCustomFiltersPath, mProjectPath);
|
||||
} else {
|
||||
filtersFound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::filesystem::path filters(mResDir);
|
||||
filters /= "defaultfilters";
|
||||
std::cout<<"Attempt to read defaultfilters from: "<<filters<<std::endl;
|
||||
|
||||
if (boost::filesystem::exists(filters))
|
||||
{
|
||||
boost::filesystem::copy_file(filters, mProjectPath);
|
||||
} else {
|
||||
std::cout<<filters<<" could not be found!"<<std::endl;
|
||||
filtersFound = true;
|
||||
}
|
||||
getData().loadFile (mProjectPath, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (filtersFound)
|
||||
getData().loadFile (mProjectPath, false, true);
|
||||
|
||||
addOptionalGmsts();
|
||||
addOptionalGlobals();
|
||||
|
||||
|
|
Loading…
Reference in a new issue