notify icon indicating copy to clipboard operation
notify copied to clipboard

Expose isDir

Open mpolden opened this issue 8 years ago • 2 comments

Would it be possible to expose the isDir function in EventInfo?

Currently I have to reimpement it for every platform, e.g. for Linux:

func IsDir(e notify.EventInfo) {
    inotifyEvent, ok := e.Sys().(*syscall.InotifyEvent)
    if !ok {
        return false
    }
    return inotifyEvent.Mask&syscall.IN_ISDIR != 0
}

From what I can tell it's currently implemented for all platforms, except kqueue, but maybe the kqueue implementation can be the same as the one for Windows (plain Stat() + IsDir check).

@rjeczalik What do you think?

mpolden avatar May 01 '16 09:05 mpolden

@martinp If we just export it instead of adding to EventInfo (it would be a backward-incompatible change) then it sounds good to me.

rjeczalik avatar May 01 '16 10:05 rjeczalik

Agreed, it would be better to not break the EventInfo interface.

mpolden avatar May 01 '16 12:05 mpolden