File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
Pathy.ApiVerificationTests Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1313 </PackageReference >
1414 <PackageReference Include =" PublicApiGenerator" Version =" 11.5.0" />
1515 <PackageReference Include =" Verify.DiffPlex" Version =" 3.1.2" />
16- <PackageReference Include =" Verify.Xunit" Version =" 31.0.3 " />
16+ <PackageReference Include =" Verify.Xunit" Version =" 31.0.5 " />
1717 </ItemGroup >
1818
1919 <ItemGroup >
Original file line number Diff line number Diff line change @@ -331,6 +331,16 @@ public void Can_get_the_root()
331331 path . Root . ToString ( ) . Should ( ) . Be ( Path . GetPathRoot ( path . ToString ( ) ) ) ;
332332 }
333333
334+ [ Fact ]
335+ public void Cannot_get_the_root_of_a_relative_path ( )
336+ {
337+ // Act
338+ var path = ChainablePath . From ( "temp/somefile.txt" ) ;
339+
340+ // Assert
341+ path . Root . ToString ( ) . Should ( ) . Be ( ChainablePath . Null ) ;
342+ }
343+
334344 [ Theory ]
335345 [ InlineData ( "C:\\ temp\\ " ) ]
336346 [ InlineData ( "C:\\ temp" ) ]
Original file line number Diff line number Diff line change 1818
1919 <ItemGroup >
2020 <PackageReference Include =" xunit" Version =" 2.9.3" />
21- <PackageReference Include =" FluentAssertions" Version =" 8.7.1 " />
21+ <PackageReference Include =" FluentAssertions" Version =" 8.8.0 " />
2222 <PackageReference Include =" JetBrains.Annotations" Version =" 2025.2.2" />
2323 <PackageReference Include =" coverlet.collector" Version =" 6.0.4" PrivateAssets =" all" >
2424 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
Original file line number Diff line number Diff line change @@ -359,7 +359,7 @@ public string Extension
359359 /// <summary>
360360 /// Gets the root directory of the current path.
361361 /// </summary>
362- public ChainablePath Root => From ( Path . GetPathRoot ( path ) ) ;
362+ public ChainablePath Root => Path . IsPathRooted ( path ) ? From ( Path . GetPathRoot ( path ) ) : Null ;
363363
364364 /// <summary>
365365 /// Gets a value indicating whether the path represented by the current object points to an existing file.
You can’t perform that action at this time.
0 commit comments