Skip to content

Commit

Permalink
common: File observer doesn't repeat the directory it observes for al…
Browse files Browse the repository at this point in the history
…l file.
  • Loading branch information
MisterGC committed Dec 27, 2023
1 parent 9814903 commit 377321d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/common/clayfilesysobserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ void ClayFileSysObserver::syncWithDir(const QString& path, bool initial)
if (QDir(path).exists())
{
const auto allFiles = fo.files();
QDirIterator it(path, QDir::NoDotDot|QDir::Files|QDir::Dirs,
QDirIterator it(path, QDir::NoDot|QDir::NoDotDot|QDir::Files|QDir::Dirs,
QDirIterator::Subdirectories);
qCInfo(logCat_).noquote() << "Observed directory:" << path;
qCInfo(logCat_).noquote() << "Files:";
while (it.hasNext()) {
it.next();
auto fp = it.filePath();
if (allFiles.contains(fp)) continue;
if (!fo.addPath(fp))
qCritical("Path %s couldn't be added for observation!",
qUtf8Printable(fp));
qCDebug(logCat_) << "Observing: " << fp;
auto relativePath = QDir(path).relativeFilePath(fp);
qCInfo(logCat_).noquote() << "- " << relativePath;
if (!initial) emit fileAdded(fp);
}
}
Expand Down

0 comments on commit 377321d

Please sign in to comment.