fix: no loops in watch paths! >:(

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-04-02 18:55:21 -07:00
parent ba2b5c3a65
commit 5ce7874280
3 changed files with 5 additions and 8 deletions

View File

@ -192,6 +192,9 @@ void BlockedModsDialog::setupWatch()
void BlockedModsDialog::watchPath(QString path, bool watch_subdirectories) 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; qDebug() << "[Blocked Mods Dialog] Adding Watch Path:" << path;
m_watcher.addPath(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); QDirIterator it(path, QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot, QDirIterator::NoIteratorFlags);
while (it.hasNext()) { while (it.hasNext()) {
QString dir_path = it.next(); QString watch_dir = QDir(it.next()).canonicalPath(); // resolve symlinks and relative paths
watchPath(dir_path, watch_subdirectories); watchPath(watch_dir, watch_subdirectories);
} }
} }

View File

@ -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() void LauncherPage::on_metadataDisableBtn_clicked()
{ {
ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked()); ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked());

View File

@ -90,7 +90,6 @@ slots:
void on_iconsDirBrowseBtn_clicked(); void on_iconsDirBrowseBtn_clicked();
void on_downloadsDirBrowseBtn_clicked(); void on_downloadsDirBrowseBtn_clicked();
void on_metadataDisableBtn_clicked(); void on_metadataDisableBtn_clicked();
void on_downloadsDirWatchRecursiveCheckBox_clicked();
/*! /*!
* Updates the font preview * Updates the font preview