Skip to content

Commit

Permalink
fix: don't try to watch the entier filesystem by watching parent links
Browse files Browse the repository at this point in the history
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
  • Loading branch information
Ryex committed Mar 21, 2023
1 parent 02bf086 commit 4bd2c19
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions launcher/ui/dialogs/BlockedModsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include "BlockedModsDialog.h"
#include <qdebug.h>
#include "ui_BlockedModsDialog.h"

#include "Application.h"
Expand Down Expand Up @@ -191,15 +192,19 @@ void BlockedModsDialog::setupWatch()

void BlockedModsDialog::watchPath(QString path, bool watch_subdirectories)
{
qDebug() << "[Blocked Mods Dialog] Adding Watch Path:" << path;
m_watcher.addPath(path);

if (!watch_subdirectories)
return;

QDirIterator it(path, QDirIterator::Subdirectories);
QDirIterator it(path, QDir::Filter::Dirs, QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
QString dir = it.next();
watchPath(it.next(), watch_subdirectories);
QString dir_path = it.next();
QDir to_watch_dir(dir_path);
if (to_watch_dir.dirName() == "." || to_watch_dir.dirName() == "..")
continue;
watchPath(dir_path, watch_subdirectories);
}
}

Expand Down

0 comments on commit 4bd2c19

Please sign in to comment.