io/fileview: ensure directory is watched for file creation

This commit is contained in:
outfoxxed 2025-02-19 21:58:05 -08:00
parent aeb347ba91
commit 1eabf5b3c3
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -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,