forked from quickshell/quickshell
io/fileview: ensure directory is watched for file creation
This commit is contained in:
parent
aeb347ba91
commit
1eabf5b3c3
1 changed files with 8 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue