From 1eabf5b3c36ca20b981017740c7fd1dacf4f6601 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Wed, 19 Feb 2025 21:58:05 -0800 Subject: [PATCH] io/fileview: ensure directory is watched for file creation --- src/io/fileview.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/io/fileview.cpp b/src/io/fileview.cpp index 23656d34..c8073af3 100644 --- a/src/io/fileview.cpp +++ b/src/io/fileview.cpp @@ -490,7 +490,14 @@ void FileView::updateWatchedFiles() { qCDebug(logFileView) << "Creating watcher for" << this << "at" << this->targetPath; this->watcher = new QFileSystemWatcher(this); this->watcher->addPath(this->targetPath); - this->watcher->addPath(QDir(this->targetPath).dirName()); + + auto dirPath = this->targetPath; + if (!dirPath.contains("/")) dirPath = "./" % dirPath; + + if (auto lastIndex = dirPath.lastIndexOf('/'); lastIndex != -1) { + dirPath = dirPath.sliced(0, lastIndex); + this->watcher->addPath(dirPath); + } QObject::connect( this->watcher,