Commit 376ca1e Simon Ensslen
committed
1 parent a90e117 commit 376ca1e Copy full SHA for 376ca1e
File tree 2 files changed +5
-4
lines changed
src/ICSharpCode.SharpZipLib/Tar
test/ICSharpCode.SharpZipLib.Tests/Tar
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,10 @@ internal static class TarStringExtension
6
6
{
7
7
public static string ClearTarPath ( this string s )
8
8
{
9
- if ( Path . GetPathRoot ( s ) != null )
9
+ var pathRoot = Path . GetPathRoot ( s ) ;
10
+ if ( ! string . IsNullOrEmpty ( pathRoot ) )
10
11
{
11
- s = s . Substring ( Path . GetPathRoot ( s ) . Length ) ;
12
+ s = s . Substring ( pathRoot . Length ) ;
12
13
}
13
14
return s . Replace ( Path . DirectorySeparatorChar , '/' ) ;
14
15
}
Original file line number Diff line number Diff line change @@ -944,7 +944,7 @@ public void rootPathIsRespected()
944
944
var expectationDirectory = new DirectoryInfo ( tempDirectory ) ;
945
945
foreach ( var checkFile in expectationDirectory . GetFiles ( "" , SearchOption . AllDirectories ) )
946
946
{
947
- var relativePath = expectationDirectory . FullName . Substring ( expectationDirectory . FullName . Length ) ;
947
+ var relativePath = checkFile . FullName . Substring ( expectationDirectory . FullName . Length + 1 ) ;
948
948
FileAssert . Exists ( Path . Combine ( extractDirectory , relativePath ) ) ;
949
949
FileAssert . AreEqual ( checkFile . FullName , Path . Combine ( extractDirectory , relativePath ) ) ;
950
950
}
@@ -954,7 +954,7 @@ private void CreateAndClearDirectory(string path)
954
954
{
955
955
if ( Directory . Exists ( path ) )
956
956
{
957
- Directory . Delete ( path ) ;
957
+ Directory . Delete ( path , true ) ;
958
958
}
959
959
Directory . CreateDirectory ( path ) ;
960
960
}
You can’t perform that action at this time.
0 commit comments