@@ -35,7 +35,7 @@ public readonly ref struct FilePath
3535 /// <summary>
3636 /// <see cref="System.IO.Path.GetPathRoot"/>
3737 /// </summary>
38- public string PathRoot => Path . GetPathRoot ( path ) ;
38+ public string ? PathRoot => Path . GetPathRoot ( path ) ;
3939
4040 /// <summary>
4141 /// <see cref="System.IO.Path.GetExtension"/>
@@ -60,27 +60,33 @@ public readonly ref struct FilePath
6060
6161 public static FilePath operator * ( FilePath path , int times )
6262 {
63- var result = path . ToString ( ) ;
63+ var result = path . path ;
6464 while ( times -- > 0 )
6565 {
66- result += path . ToString ( ) ;
66+ result += path . path ;
6767 }
6868
6969 return result ;
7070 }
7171
7272 public static FilePath operator << ( FilePath path , int times )
7373 {
74- var result = path . ToString ( ) ;
74+ var result = path . path ;
7575 while ( times -- > 0 )
7676 {
7777 result = Path . GetDirectoryName ( result ) ;
7878 }
7979
8080 return result ;
8181 }
82-
83- public static implicit operator FilePath ( string path ) => new ( path ) ;
82+
83+ #if NET || NETSTANDARD2_1
84+ public static FilePath operator >> ( FilePath from , FilePath to ) => global ::System . IO . Path . GetRelativePath ( from , to ) ;
85+
86+ public static FilePath operator << ( FilePath to , FilePath from ) => global ::System . IO . Path . GetRelativePath ( from , to ) ;
87+ #endif
88+
89+ public static implicit operator FilePath ( string path ) => new ( path ) ;
8490 public static implicit operator FilePath ( string [ ] paths ) => Path . Combine ( paths ) ;
85- public static implicit operator string ( FilePath path ) => path . ToString ( ) ;
91+ public static implicit operator string ( FilePath path ) => path . path ;
8692}
0 commit comments