diff options
| author | Al <26797547+Al12rs@users.noreply.github.com> | 2020-01-19 16:32:32 +0100 |
|---|---|---|
| committer | Al <26797547+Al12rs@users.noreply.github.com> | 2020-01-19 16:32:32 +0100 |
| commit | 304ca8066fdb097464b13597be70f321bebc2347 (patch) | |
| tree | 6feac2e7cb6f18b9a038f2c1c77eddfe28ef5d7c /src/modinfowithconflictinfo.cpp | |
| parent | 58f35960281cf2522f3399b80ee1375afa6f1282 (diff) | |
Also check for .mohidden directories for HiddenFiles flag.
Diffstat (limited to 'src/modinfowithconflictinfo.cpp')
| -rw-r--r-- | src/modinfowithconflictinfo.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/modinfowithconflictinfo.cpp b/src/modinfowithconflictinfo.cpp index df5068ca..b068ad4a 100644 --- a/src/modinfowithconflictinfo.cpp +++ b/src/modinfowithconflictinfo.cpp @@ -98,15 +98,39 @@ void ModInfoWithConflictInfo::doConflictCheck() const if ((*m_DirectoryStructure)->originExists(name)) { FilesOrigin &origin = (*m_DirectoryStructure)->getOriginByName(name); std::vector<FileEntry::Ptr> files = origin.getFiles(); + std::set<const DirectoryEntry*> checkedDirs; + // for all files in this origin for (FileEntry::Ptr file : files) { - //Skip hiidden file check if already found one + // skip hiidden file check if already found one if (!hasHiddenFiles) { const fs::path nameAsPath(file->getName()); + if (nameAsPath.extension().wstring().compare(L".mohidden") == 0) { hasHiddenFiles = true; } + else { + const DirectoryEntry* parent = file->getParent(); + + // iterate on all parent direEntries to check for .mohiddden + while (parent != nullptr) { + auto insertResult = checkedDirs.insert(parent); + + if (insertResult.second == false) { + // if already present break as we can assume to have checked the parents as well + break; + } + else { + const fs::path dirPath(parent->getName()); + if (dirPath.extension().wstring().compare(L".mohidden") == 0) { + hasHiddenFiles = true; + break; + } + parent = parent->getParent(); + } + } + } } auto alternatives = file->getAlternatives(); |
