This repository was archived by the owner on Nov 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathNullFileProvider.cs
34 lines (30 loc) · 1.58 KB
/
NullFileProvider.cs
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
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Extensions.Primitives;
namespace Microsoft.Extensions.FileProviders
{
/// <summary>
/// An empty file provider with no contents.
/// </summary>
public class NullFileProvider : IFileProvider
{
/// <summary>
/// Enumerate a non-existent directory.
/// </summary>
/// <param name="subpath">A path under the root directory. This parameter is ignored.</param>
/// <returns>A <see cref="IDirectoryContents"/> that does not exist and does not contain any contents.</returns>
public IDirectoryContents GetDirectoryContents(string subpath) => NotFoundDirectoryContents.Singleton;
/// <summary>
/// Locate a non-existent file.
/// </summary>
/// <param name="subpath">A path under the root directory.</param>
/// <returns>A <see cref="IFileInfo"/> representing a non-existent file at the given path.</returns>
public IFileInfo GetFileInfo(string subpath) => new NotFoundFileInfo(subpath);
/// <summary>
/// Returns a <see cref="IChangeToken"/> that monitors nothing.
/// </summary>
/// <param name="filter">Filter string used to determine what files or folders to monitor. This parameter is ignored.</param>
/// <returns>A <see cref="IChangeToken"/> that does not register callbacks.</returns>
public IChangeToken Watch(string filter) => NullChangeToken.Singleton;
}
}