Skip to content

Commit 1906da8

Browse files
committed
Expose PhysicalFileSystem.Root property
1 parent bb04841 commit 1906da8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Ramstack.FileSystem.Physical/PhysicalFileSystem.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ namespace Ramstack.FileSystem.Physical;
55
/// <summary>
66
/// Represents an implementation of <see cref="IVirtualFileSystem"/> for physical files.
77
/// </summary>
8-
[DebuggerDisplay("Root = {_root,nq}")]
8+
[DebuggerDisplay("Root = {Root,nq}")]
99
public sealed class PhysicalFileSystem : IVirtualFileSystem
1010
{
11-
private readonly string _root;
11+
/// <summary>
12+
/// Gets the physical path of the root directory for this instance.
13+
/// </summary>
14+
public string Root { get; }
1215

1316
/// <summary>
1417
/// Gets or sets a value indicating whether the file system is read-only.
@@ -18,13 +21,13 @@ public sealed class PhysicalFileSystem : IVirtualFileSystem
1821
/// <summary>
1922
/// Initializes a new instance of the <see cref="PhysicalFileSystem"/> class.
2023
/// </summary>
21-
/// <param name="path">The physical path of the directory.</param>
24+
/// <param name="path">The physical path of root the directory.</param>
2225
public PhysicalFileSystem(string path)
2326
{
2427
if (!Path.IsPathRooted(path))
2528
Error(path);
2629

27-
_root = Path.GetFullPath(path);
30+
Root = Path.GetFullPath(path);
2831

2932
static void Error(string path) =>
3033
throw new ArgumentException($"The path '{path}' must be absolute.");
@@ -64,6 +67,6 @@ void IDisposable.Dispose()
6467
private string GetPhysicalPath(string path)
6568
{
6669
Debug.Assert(VirtualPath.IsNormalized(path));
67-
return Path.Join(_root, path);
70+
return Path.Join(Root, path);
6871
}
6972
}

0 commit comments

Comments
 (0)