-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotFoundDirectory.cs
More file actions
47 lines (38 loc) · 1.7 KB
/
NotFoundDirectory.cs
File metadata and controls
47 lines (38 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Ramstack.FileSystem.Utilities;
namespace Ramstack.FileSystem.Null;
/// <summary>
/// Represents a non-existing directory.
/// </summary>
public sealed class NotFoundDirectory : VirtualDirectory
{
/// <inheritdoc />
public override IVirtualFileSystem FileSystem { get; }
/// <summary>
/// Initializes a new instance of the <see cref="NotFoundDirectory"/> class.
/// </summary>
/// <param name="fileSystem">The file system associated with this directory.</param>
/// <param name="path">The path of the directory.</param>
public NotFoundDirectory(IVirtualFileSystem fileSystem, string path) : base(VirtualPath.Normalize(path)) =>
FileSystem = fileSystem;
/// <inheritdoc />
protected override ValueTask<VirtualNodeProperties?> GetPropertiesCoreAsync(CancellationToken cancellationToken) =>
default;
/// <inheritdoc />
protected override ValueTask<bool> ExistsCoreAsync(CancellationToken cancellationToken) =>
default;
/// <inheritdoc />
protected override ValueTask CreateCoreAsync(CancellationToken cancellationToken)
{
Error_UnauthorizedAccess(FullName);
return default;
}
/// <inheritdoc />
protected override ValueTask DeleteCoreAsync(CancellationToken cancellationToken) =>
default;
/// <inheritdoc />
protected override IAsyncEnumerable<VirtualNode> GetFileNodesCoreAsync(CancellationToken cancellationToken) =>
Array.Empty<VirtualNode>().ToAsyncEnumerable();
[DoesNotReturn]
private static void Error_UnauthorizedAccess(string path) =>
throw new UnauthorizedAccessException($"Access to the path '{path}' is denied.");
}