-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathDirectoryInfoFactory.cs
More file actions
40 lines (35 loc) · 1.04 KB
/
DirectoryInfoFactory.cs
File metadata and controls
40 lines (35 loc) · 1.04 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
namespace System.IO.Abstractions
{
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
internal class DirectoryInfoFactory : IDirectoryInfoFactory
{
private readonly IFileSystem fileSystem;
/// <summary>
/// Base factory class for creating a <see cref="IDirectoryInfo"/>
/// </summary>
public DirectoryInfoFactory(IFileSystem fileSystem)
{
this.fileSystem = fileSystem;
}
/// <inheritdoc />
public IFileSystem FileSystem
=> fileSystem;
/// <inheritdoc />
public IDirectoryInfo New(string path)
{
var realDirectoryInfo = new DirectoryInfo(path);
return new DirectoryInfoWrapper(fileSystem, realDirectoryInfo);
}
/// <inheritdoc />
public IDirectoryInfo Wrap(DirectoryInfo directoryInfo)
{
if (directoryInfo == null)
{
return null;
}
return new DirectoryInfoWrapper(fileSystem, directoryInfo);
}
}
}