diff options
| author | Al <26797547+Al12rs@users.noreply.github.com> | 2020-05-20 13:05:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-20 13:05:02 +0200 |
| commit | b7110cba2dceb172bf6a903f1c5de5ff1c460f11 (patch) | |
| tree | ee3be3be522842c6ef42c14d48c822fa657333c9 /src/modinfowithconflictinfo.cpp | |
| parent | c214b67ae784537d696a53c8cae00676eefd3841 (diff) | |
| parent | c391c2b584a309f64f87dd5e00b0083279e6211c (diff) | |
Merge pull request #1066 from Holt59/new-filetree
Update for the new file tree implementation and minor fixes
Diffstat (limited to 'src/modinfowithconflictinfo.cpp')
| -rw-r--r-- | src/modinfowithconflictinfo.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
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; +} |
