-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDefaultFileSystem.cs
More file actions
39 lines (33 loc) · 1.03 KB
/
DefaultFileSystem.cs
File metadata and controls
39 lines (33 loc) · 1.03 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
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace T4Scaffolding.Core.FileSystem
{
public class DefaultFileSystem : IFileSystem
{
public bool DirectoryExists(string path)
{
return Directory.Exists(path);
}
public bool FileExists(string path)
{
return File.Exists(path);
}
public void CreateDirectory(string path)
{
Directory.CreateDirectory(path);
}
public string ReadAllText(string path)
{
return File.ReadAllText(path);
}
public void WriteAllText(string path, string textContents)
{
File.WriteAllText(path, textContents, new UTF8Encoding(true));
}
public IEnumerable<string> FindFiles(string path, string pattern, bool includeSubdirectories)
{
return Directory.EnumerateFiles(path, pattern, includeSubdirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
}
}
}