aboutsummaryrefslogtreecommitdiff
path: root/launcher/FileIgnoreProxy.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-30 00:01:36 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-30 00:01:36 +0300
commit87efa700ab53148f0555605fa21c683f3a9c3d15 (patch)
tree31437fa871cec74ed3ebcf01a393270813366645 /launcher/FileIgnoreProxy.cpp
parentfaec21d572549793293bf41127e384811f8a66dc (diff)
downloadPrismLauncher-87efa700ab53148f0555605fa21c683f3a9c3d15.tar.gz
PrismLauncher-87efa700ab53148f0555605fa21c683f3a9c3d15.tar.bz2
PrismLauncher-87efa700ab53148f0555605fa21c683f3a9c3d15.zip
Removed logs from instance export
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/FileIgnoreProxy.cpp')
-rw-r--r--launcher/FileIgnoreProxy.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/launcher/FileIgnoreProxy.cpp b/launcher/FileIgnoreProxy.cpp
index a3b7d505..1f6b664c 100644
--- a/launcher/FileIgnoreProxy.cpp
+++ b/launcher/FileIgnoreProxy.cpp
@@ -40,6 +40,7 @@
#include <QFileSystemModel>
#include <QSortFilterProxyModel>
#include <QStack>
+#include <algorithm>
#include "FileSystem.h"
#include "SeparatorPrefixTree.h"
#include "StringUtils.h"
@@ -254,3 +255,16 @@ bool FileIgnoreProxy::filterAcceptsColumn(int source_column, const QModelIndex&
return true;
}
+
+bool FileIgnoreProxy::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
+{
+ QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
+ QFileSystemModel* fsm = qobject_cast<QFileSystemModel*>(sourceModel());
+
+ auto fileInfo = fsm->fileInfo(index);
+ auto fileName = fileInfo.fileName();
+ auto path = relPath(fileInfo.absoluteFilePath());
+ return !(path.startsWith("..") || // just in case ignore files outside the gameroot
+ std::any_of(m_ignoreFiles.cbegin(), m_ignoreFiles.cend(), [fileName](auto iFileName) { return fileName == iFileName; }) ||
+ std::any_of(m_ignoreFilePaths.cbegin(), m_ignoreFilePaths.cend(), [path](auto iPath) { return path == iPath; }));
+}