Skip to content

Commit

Permalink
Merge pull request #24 from Rohansi/add-canwatchimpls
Browse files Browse the repository at this point in the history
Add CanWatch impls to physical and composite FS
  • Loading branch information
xoofx committed Jan 12, 2018
2 parents 8b6efb5 + 67583e5 commit 1e11cf5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Zio/FileSystems/AggregateFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ protected override UPath ConvertPathFromDelegate(UPath path)
// Watch API
// ----------------------------------------------

/// <inheritdoc />
protected override bool CanWatchImpl(UPath path)
{
// Always allow watching because a future filesystem can be added that matches this path.
return true;
}

/// <inheritdoc />
protected override IFileSystemWatcher WatchImpl(UPath path)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Zio/FileSystems/ComposeFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ protected override IEnumerable<UPath> EnumeratePathsImpl(UPath path, string sear
// ----------------------------------------------
// Watch API
// ----------------------------------------------

/// <inheritdoc />
protected override bool CanWatchImpl(UPath path)
{
return NextFileSystemSafe.CanWatch(ConvertPathToDelegate(path));
}

/// <inheritdoc />
protected override IFileSystemWatcher WatchImpl(UPath path)
Expand Down
7 changes: 7 additions & 0 deletions src/Zio/FileSystems/MountFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,13 @@ IEnumerable<UPath> EnumeratePathFromFileSystem(UPath subPath, bool failOnInvalid
}
}

/// <inheritdoc />
protected override bool CanWatchImpl(UPath path)
{
// Always allow watching because a future filesystem can be added that matches this path.
return true;
}

/// <inheritdoc />
protected override IFileSystemWatcher WatchImpl(UPath path)
{
Expand Down
11 changes: 11 additions & 0 deletions src/Zio/FileSystems/PhysicalFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,17 @@ protected override IEnumerable<UPath> EnumeratePathsImpl(UPath path, string sear
// ----------------------------------------------
// Watch API
// ----------------------------------------------

/// <inheritdoc />
protected override bool CanWatchImpl(UPath path)
{
if (IsWithinSpecialDirectory(path))
{
return SpecialDirectoryExists(path);
}

return Directory.Exists(ConvertPathToInternal(path));
}

/// <inheritdoc />
protected override IFileSystemWatcher WatchImpl(UPath path)
Expand Down

0 comments on commit 1e11cf5

Please sign in to comment.