File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed
Core.Common.Standard.Tests Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 50
50
</ItemGroup >
51
51
<ItemGroup >
52
52
<Compile Include =" ObjectExtensionTests.cs" />
53
+ <Compile Include =" PathHelperTests.cs" />
53
54
<Compile Include =" Properties\AssemblyInfo.cs" />
54
55
</ItemGroup >
55
56
<ItemGroup >
Original file line number Diff line number Diff line change
1
+ using KY . Core . DataAccess ;
2
+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
3
+
4
+ namespace KY . Core . Common . Standard . Tests
5
+ {
6
+ [ TestClass ]
7
+ public class PathHelperTests
8
+ {
9
+ [ TestMethod ]
10
+ public void TestCombineWithRelativePathAndDuplicateDirectoryName ( )
11
+ {
12
+ PathHelper pathHelper = new PathHelper ( ) ;
13
+ string result = pathHelper . Combine ( @"C:\One\Two\Three\Two" , "../Four" ) ;
14
+ Assert . AreEqual ( @"C:\One\Two\Three\Four" , result ) ;
15
+ }
16
+
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ public class PathHelper
18
18
private static readonly Regex absolutePathRegex = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows )
19
19
? new Regex ( @"^(([A-z]:)|(file:\\\\)|(\\\\))" )
20
20
: new Regex ( "^/" ) ;
21
+
21
22
public string Root { get ; }
22
23
23
24
public PathHelper ( string root = null )
@@ -98,10 +99,10 @@ public string Combine(params string[] pathChunks)
98
99
}
99
100
else if ( isDrive && parts . Count > 1 || ! isDrive && parts . Count > 0 )
100
101
{
101
- parts . Remove ( last ) ;
102
+ parts . RemoveAt ( parts . Count - 1 ) ;
102
103
}
103
104
}
104
- else if ( parts . Count == 0 || last == parentSymbol )
105
+ else if ( parts . Count == 0 || last == parentSymbol )
105
106
{
106
107
parts . Add ( chunk ) ;
107
108
}
Original file line number Diff line number Diff line change 4
4
<TargetFramework >netstandard2.0</TargetFramework >
5
5
<RootNamespace >KY.Core</RootNamespace >
6
6
<AssemblyName >KY.Core.Common</AssemblyName >
7
- <Version >4.17 .0</Version >
7
+ <Version >4.18 .0</Version >
8
8
<Authors >KY-Programming</Authors >
9
9
<Company >KY-Programmingp</Company >
10
10
<Product >KY.Core</Product >
You can’t perform that action at this time.
0 commit comments