forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIFileSystem.cs
More file actions
59 lines (52 loc) · 1.92 KB
/
Copy pathIFileSystem.cs
File metadata and controls
59 lines (52 loc) · 1.92 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
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
using System.Collections.Generic;
namespace React
{
/// <summary>
/// Handles file system functionality, such as reading files.
/// </summary>
public interface IFileSystem
{
/// <summary>
/// Converts a path from an application relative path (~/...) to a full filesystem path
/// </summary>
/// <param name="relativePath">App-relative path of the file</param>
/// <returns>Full path of the file</returns>
string MapPath(string relativePath);
/// <summary>
/// Converts a path from a full filesystem path to anan application relative path (~/...)
/// </summary>
/// <param name="absolutePath">Full path of the file</param>
/// <returns>App-relative path of the file</returns>
string ToRelativePath(string absolutePath);
/// <summary>
/// Reads the contents of a file as a string.
/// </summary>
/// <param name="relativePath">App-relative path of the file</param>
/// <returns>Contents of the file</returns>
string ReadAsString(string relativePath);
/// <summary>
/// Writes a string to a file
/// </summary>
/// <param name="relativePath">App-relative path of the file</param>
/// <param name="contents">Contents of the file</param>
void WriteAsString(string relativePath, string contents);
/// <summary>
/// Determines if the specified file exists
/// </summary>
/// <param name="relativePath">App-relative path of the file</param>
/// <returns><c>true</c> if the file exists</returns>
bool FileExists(string relativePath);
/// <summary>
/// Gets all the files that match the specified pattern
/// </summary>
/// <param name="glob">Pattern to search for (eg. "~/Scripts/*.js")</param>
/// <returns>File names that match the pattern</returns>
IEnumerable<string> Glob(string glob);
}
}