WebFreak001 / FSWatch

A cross-platform folder & file watching library using win32, inotify or std.file
33 stars 8 forks source link

Handle File not found error on Create event(Linux) #18

Closed aravindavk closed 5 years ago

aravindavk commented 5 years ago

If a file is created and deleted immediately, isDir check is failing with FileException. With this patch, error is ignored in case of ENOENT.

Reproducer: Start the example program and create a file in watched directory using vi editor.

Signed-off-by: Aravinda VK mail@aravindavk.in

WebFreak001 commented 5 years ago

hm I think instead of doing try/catch it would be better performing a stat and checking for ENOENT and otherwise throw a FileException from fswatch. The stat result would then contain if it is a directory.

aravindavk commented 5 years ago

file.getAttributes also throws FileException, please suggest which one use to get stat.