From 304ca8066fdb097464b13597be70f321bebc2347 Mon Sep 17 00:00:00 2001 From: Al <26797547+Al12rs@users.noreply.github.com> Date: Sun, 19 Jan 2020 16:32:32 +0100 Subject: Also check for .mohidden directories for HiddenFiles flag. --- src/modinfowithconflictinfo.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/modinfowithconflictinfo.cpp') 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 files = origin.getFiles(); + std::set 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(); -- cgit v1.3.1