Skip to content

Commit

Permalink
Fixed inotify ignoring hidden files
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Zoubek authored and Majkluss committed Mar 8, 2023
1 parent 5ccfdbf commit faf9a72
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions prusa/connect/printer/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,23 +718,24 @@ def __call__(self, timeout=0):
events = self.inotify.read(timeout=timeout)
events = self.filter_delete_events(events)
for event in events:
parent_dir = self.wds[event.wd]
for storage in self.fs.storage_dict.values():
if parent_dir.startswith(storage.path_storage):
storage.last_updated = time()
for flag in flags.from_mask(event.mask):
# remove wds that are no longer needed
if flag.name == "IGNORED":
del self.wds[event.wd]
continue
# ignore non watched events
if not self.WATCH_FLAGS & flag:
log.debug("Ignoring %s", flag.name)
continue

abs_path = path.join(parent_dir, event.name)
# Ignore hidden files .<filename>
if not event.name.startswith("."):
# Ignore hidden files .<filename>
if not event.name.startswith("."):
parent_dir = self.wds[event.wd]
for storage in self.fs.storage_dict.values():
if parent_dir.startswith(storage.path_storage):
storage.last_updated = time()
for flag in flags.from_mask(event.mask):
# remove wds that are no longer needed
if flag.name == "IGNORED":
del self.wds[event.wd]
continue
# ignore non watched events
if not self.WATCH_FLAGS & flag:
log.debug("Ignoring %s", flag.name)
continue

abs_path = path.join(parent_dir, event.name)

log.debug("Flag: %s %s %s", flag.name, abs_path, event)
handler = self.HANDLERS[flag.name]
log.debug("Calling %s: %s", handler, abs_path)
Expand Down

0 comments on commit faf9a72

Please sign in to comment.