xoofx / zio

A cross-platform abstract/virtual filesystem framework with many built-ins filesystems for .NET
BSD 2-Clause "Simplified" License
817 stars 61 forks source link

IFileSystem that doesn't support Watch #12

Closed Rohansi closed 6 years ago

Rohansi commented 6 years ago

What should a filesystem that doesn't support watching do? I'm thinking returning null might be better than throwing because we should allow watching on composites (aggregate, mount) even when one of the filesystems cannot be watched.

What do you think?

xoofx commented 6 years ago

Will get back to you on this next week

xoofx commented 6 years ago

Not sure I like the idea of returning null, as it makes the API unbalanced (compare for example to OpenStream that doesn't return null if it can't, even if it is slightly different) and having potential null around is often an annoyance if you are not aware of it...

What about adding a CanWatch method?, maybe also by adding a default implementation to the FileSystem base, returning true, that could simplify the implementation trouble of having to add a new method...

What do you think?

Rohansi commented 6 years ago

A CanWatch method sounds good. Would it check a given path or be for the entire IFileSystem instance?

There's also the option of a NullFileSystemWatcher that doesn't do anything but I'm not a fan of that.

xoofx commented 6 years ago

A CanWatch method sounds good. Would it check a given path or be for the entire IFileSystem instance?

I would say it takes a path, so that it allows fine-grained control there.

Rohansi commented 6 years ago

This was fixed by #18.