Skip to content

Commit cbe7f29

Browse files
committed
Log directories skipped by watcher
1 parent dcbe292 commit cbe7f29

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/daemon/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ void initialSearchForAppImages(const QDirSet& dirsToSearch, Worker& worker) {
6262
std::cout << "Searching for existing AppImages" << std::endl;
6363

6464
for (const auto& dir : dirsToSearch) {
65+
if (!dir.exists()) {
66+
std::cout << "Directory " << dir.path().toStdString() << " does not exist, skipping" << std::endl;
67+
continue;
68+
}
69+
6570
std::cout << "Searching directory: " << dir.absolutePath().toStdString() << std::endl;
6671

6772
for (QDirIterator it(dir); it.hasNext();) {

src/fswatcher/filesystemwatcher.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,11 @@ bool FileSystemWatcher::updateWatchedDirectories(QDirSet watchedDirectories) {
288288
// so when they'll be created, we'll notice
289289
{
290290
// erase-remove doesn't work with sets apparently (see https://stackoverflow.com/a/26833313)
291-
// therefore we use a simple custom algorithm
292-
auto it = watchedDirectories.begin();
293-
while (it != watchedDirectories.end()) {
291+
// therefore we use a simple linear search to remove non-existing directories
292+
for (auto it = watchedDirectories.begin(); it != watchedDirectories.end(); ++it) {
294293
if (!it->exists()) {
294+
std::cout << "Directory " << it->path().toStdString() << " does not exist, skipping" << std::endl;
295295
it = watchedDirectories.erase(it);
296-
} else {
297-
++it;
298296
}
299297
}
300298
}

0 commit comments

Comments
 (0)