aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-02 18:55:21 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-02 18:55:21 -0700
commit5ce7874280f648e1db240ad922a2e62a7ccedea2 (patch)
treed231c53a8833a6902b10b5b39003fe6c9131fb04 /launcher/ui/dialogs
parentba2b5c3a65089e3807ebd57a1504591f8dab4049 (diff)
downloadPrismLauncher-5ce7874280f648e1db240ad922a2e62a7ccedea2.tar.gz
PrismLauncher-5ce7874280f648e1db240ad922a2e62a7ccedea2.tar.bz2
PrismLauncher-5ce7874280f648e1db240ad922a2e62a7ccedea2.zip
fix: no loops in watch paths! >:(
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp
index 7b3a395a..90078a98 100644
--- a/launcher/ui/dialogs/BlockedModsDialog.cpp
+++ b/launcher/ui/dialogs/BlockedModsDialog.cpp
@@ -192,6 +192,9 @@ void BlockedModsDialog::setupWatch()
void BlockedModsDialog::watchPath(QString path, bool watch_subdirectories)
{
+ if (m_watcher.directories().contains(path))
+ return; // don't watch the same path twice (no loops!)
+
qDebug() << "[Blocked Mods Dialog] Adding Watch Path:" << path;
m_watcher.addPath(path);
@@ -200,8 +203,8 @@ void BlockedModsDialog::watchPath(QString path, bool watch_subdirectories)
QDirIterator it(path, QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot, QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
- QString dir_path = it.next();
- watchPath(dir_path, watch_subdirectories);
+ QString watch_dir = QDir(it.next()).canonicalPath(); // resolve symlinks and relative paths
+ watchPath(watch_dir, watch_subdirectories);
}
}