Skip to content

File/Folder access event #125

@gmdfalk

Description

@gmdfalk

Hey,

do you think it's reasonable to expose a new Accessed event that indicates if a file or folder was accessed?
An example use case would be the cloud synchronization client i'm trying to build that uses lazy loading to load the content of folders or even individual files ad hoc once they're accessed.

I noticed that you are already sending a PlatformSpecific event like that for inotify and Fen:

Fen:
    flags.push_back({FILE_ACCESS,      fsw_event_flag::PlatformSpecific});
Inotify:
    if (event->mask & IN_ACCESS) flags.push_back(fsw_event_flag::PlatformSpecific);

From what i could gather neither FSEvents nor ReadDirectoryChangesW nor KQueue seem to have a similar event indicating file access.
The basic poll monitor could be extended using ATIME in addition to MTIME, albeit probably at a high performance cost. Maybe there are solutions for OSX and Windows, too.

Do you think an access event like that would be worthwile? Do you see a way to make it work with FS APIs on Windows and macOS?

Regards

P.S.: On Windows using ReadDirectoryChangesW it seems like the event FILE_NOTIFY_CHANGE_LAST_ACCESS should work but i have compiled fswatch with cygwin and that event did not seem to be triggered when accessing files and folders. Also, as a side note, compiling fswatch only works in 32bit cygwin. The error message in 64bit cygwin during the make process was not helpful at all so you might want to add this bit of information to the INSTALL file or README.windows.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions