diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-08-18 02:25:24 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-08-18 08:51:12 +0200 |
commit | 96fdaebb5c8c8902c98c1fb43e755cf90fc15198 (patch) | |
tree | bb4e1ace6bb0800a5991884d5f07b41267699283 /logic/RecursiveFileSystemWatcher.cpp | |
parent | 4e3af265dad57a27af4051cb574fb90539d287d0 (diff) | |
download | MultiMC-96fdaebb5c8c8902c98c1fb43e755cf90fc15198.tar MultiMC-96fdaebb5c8c8902c98c1fb43e755cf90fc15198.tar.gz MultiMC-96fdaebb5c8c8902c98c1fb43e755cf90fc15198.tar.lz MultiMC-96fdaebb5c8c8902c98c1fb43e755cf90fc15198.tar.xz MultiMC-96fdaebb5c8c8902c98c1fb43e755cf90fc15198.zip |
GH-926 implement log cleaning functionality
Also adds gzip compressed log support
Diffstat (limited to 'logic/RecursiveFileSystemWatcher.cpp')
-rw-r--r-- | logic/RecursiveFileSystemWatcher.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/logic/RecursiveFileSystemWatcher.cpp b/logic/RecursiveFileSystemWatcher.cpp index 39985699..1253870b 100644 --- a/logic/RecursiveFileSystemWatcher.cpp +++ b/logic/RecursiveFileSystemWatcher.cpp @@ -4,7 +4,7 @@ #include <QDebug> RecursiveFileSystemWatcher::RecursiveFileSystemWatcher(QObject *parent) - : QObject(parent), m_exp(".*"), m_watcher(new QFileSystemWatcher(this)) + : QObject(parent), m_watcher(new QFileSystemWatcher(this)) { connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &RecursiveFileSystemWatcher::fileChange); @@ -82,16 +82,20 @@ void RecursiveFileSystemWatcher::addFilesToWatcherRecursive(const QDir &dir) QStringList RecursiveFileSystemWatcher::scanRecursive(const QDir &directory) { QStringList ret; - QRegularExpression exp(m_exp); + if(!m_matcher) + { + return {}; + } for (const QString &dir : directory.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { ret.append(scanRecursive(directory.absoluteFilePath(dir))); } for (const QString &file : directory.entryList(QDir::Files)) { - if (exp.match(file).hasMatch()) + auto relPath = m_root.relativeFilePath(directory.absoluteFilePath(file)); + if (m_matcher->matches(relPath)) { - ret.append(m_root.relativeFilePath(directory.absoluteFilePath(file))); + ret.append(relPath); } } return ret; |