dart-lang / watcher

A file system watcher library for Dart.
https://pub.dev/packages/watcher
BSD 3-Clause "New" or "Revised" License
138 stars 35 forks source link

Please Introduce FileWatcher ChangeType.OPEN #113

Open technolion opened 3 years ago

technolion commented 3 years ago

I am watching files to detect changes in their content. But FileWatcher also fires a ChangeType.MODIFY event when the file is opened. I can reproduce this at least on macOS, where the file system does persist the timestamp of the last time it was opened/accessed.

So technically opening a file (on macOS at least, possibly other OS) does change the file, so it justifies a ChangeType.MODIFY event. But: It would be really great if developers could differentiate between opening a file and modifying it's content.

So how about introducing a new ChangeType.OPEN that would only fire, when the file's last open date is being modified. The ChangeType.MODIFY should then no longer fire, when the file's last open date is being modified.