aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
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
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')
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.cpp7
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp5
-rw-r--r--launcher/ui/pages/global/LauncherPage.h1
3 files changed, 5 insertions, 8 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);
}
}
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index 20e02230..51652320 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -184,11 +184,6 @@ void LauncherPage::on_downloadsDirBrowseBtn_clicked()
}
}
-void LauncherPage::on_downloadsDirWatchRecursiveCheckBox_clicked()
-{
- // incase anything needs to be done here
-}
-
void LauncherPage::on_metadataDisableBtn_clicked()
{
ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked());
diff --git a/launcher/ui/pages/global/LauncherPage.h b/launcher/ui/pages/global/LauncherPage.h
index c5ebbe39..33f66f1b 100644
--- a/launcher/ui/pages/global/LauncherPage.h
+++ b/launcher/ui/pages/global/LauncherPage.h
@@ -90,7 +90,6 @@ slots:
void on_iconsDirBrowseBtn_clicked();
void on_downloadsDirBrowseBtn_clicked();
void on_metadataDisableBtn_clicked();
- void on_downloadsDirWatchRecursiveCheckBox_clicked();
/*!
* Updates the font preview