# HG changeset patch # User Paper # Date 1762517371 18000 # Node ID c3f717b7321bfb90d6f5661143d83c8c92654eba # Parent 2d3e103191125fa41c1b892ee5735d9c957fd085 filesystem: only iterate over the list once when erasing deleted files :) diff -r 2d3e10319112 -r c3f717b7321b src/core/filesystem.cc --- a/src/core/filesystem.cc Fri Nov 07 07:08:57 2025 -0500 +++ b/src/core/filesystem.cc Fri Nov 07 07:09:31 2025 -0500 @@ -79,8 +79,9 @@ }; /* ------------------------------------------------------------------------ */ -/* Non-recursive filesystem watcher. - * This is the portable version for non-Windows */ +/* Filesystem watcher. + * This is the portable version for non-Windows (of which the Windows + * specific version hasn't been written yet... TODO) */ template class StdFilesystemWatcher : public Watcher { @@ -115,7 +116,8 @@ } protected: - bool FindAndTogglePath(const std::filesystem::path &p) { + bool FindAndTogglePath(const std::filesystem::path &p) + { for (auto &pp : paths_) { if (pp.path == p) { pp.found = true; @@ -134,14 +136,11 @@ void DeleteUntoggledPaths() { - for (const auto &path : paths_) - if (!path.found) - handler_(opaque_, path.path, Event::Deleted); - auto it = paths_.begin(); while (it != paths_.end()) { if (!it->found) { + handler_(opaque_, it->path, Event::Deleted); it = paths_.erase(it); } else { it++;