From 5a90eecc21412fa705837eb724250ef1b758c993 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Thu, 7 May 2020 02:07:15 +0200 Subject: Fix issue with mods not being checked properly and overwrite not having the right priority. --- src/modinfowithconflictinfo.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/modinfowithconflictinfo.cpp') diff --git a/src/modinfowithconflictinfo.cpp b/src/modinfowithconflictinfo.cpp index 2b4fa11c..d0516d06 100644 --- a/src/modinfowithconflictinfo.cpp +++ b/src/modinfowithconflictinfo.cpp @@ -1,4 +1,5 @@ #include "modinfowithconflictinfo.h" +#include "installationtester.h" #include "utility.h" #include "shared/directoryentry.h" #include "shared/filesorigin.h" @@ -291,3 +292,33 @@ bool ModInfoWithConflictInfo::hasHiddenFiles() const return m_HasHiddenFiles; } + + +bool ModInfoWithConflictInfo::doTestValid() const { + + bool valid = false; + QDirIterator dirIter(absolutePath()); + while (dirIter.hasNext()) { + dirIter.next(); + if (dirIter.fileInfo().isDir()) { + if (InstallationTester::isTopLevelDirectory(dirIter.fileName())) { + valid = true; + break; + } + } + else { + if (InstallationTester::isTopLevelSuffix(dirIter.fileName())) { + valid = true; + break; + } + } + } + + // NOTE: in Qt 4.7 it seems that QDirIterator leaves a file handle open if it is not iterated to the + // end + while (dirIter.hasNext()) { + dirIter.next(); + } + + return valid; +} -- cgit v1.3.1