Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit e9e51ff

Browse files
authored
Merge pull request #479 from ServiceStack/netcore
Fix directory separator on Linux
2 parents d7e8e03 + 571e8ad commit e9e51ff

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

NuGet.Core/ServiceStack.Text.Core/servicestack.text.core.nuspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
<dependency id="Microsoft.CSharp" version="[4.0.1, )" />
2828
<dependency id="System.Reflection.Emit" version="[4.0.1, )" />
2929
<dependency id="System.Reflection.Extensions" version="[4.0.1, )" />
30-
<dependency id="NETStandard.Library" version="[1.6.0, )" />
30+
<dependency id="System.Runtime.InteropServices.RuntimeInformation" version="[4.0.0, )" />
31+
<dependency id="NETStandard.Library" version="[1.6.0, )" />
3132
</group>
3233
<group targetFramework=".NETStandard1.3">
3334
<dependency id="System.Runtime.Serialization.Primitives" version="[4.1.1, )" />

src/ServiceStack.Text/PclExport.NetStandard.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Globalization;
1313
using System.Reflection;
1414
using System.Reflection.Emit;
15+
using System.Runtime.InteropServices;
1516

1617
#if NETSTANDARD1_3
1718
using System.Collections.Specialized;
@@ -56,6 +57,11 @@ public class NetStandardPclExport : PclExport
5657
public NetStandardPclExport()
5758
{
5859
this.PlatformName = Platforms.NetStandard;
60+
#if NETSTANDARD1_3
61+
this.DirSep = Path.DirectorySeparatorChar;
62+
#else
63+
this.DirSep = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? '\\' : '/';
64+
#endif
5965
}
6066

6167
public override string ReadAllText(string filePath)

src/ServiceStack.Text/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"System.Reflection.Emit": "4.0.1",
3232
"System.Reflection.Emit.LightWeight" : "4.0.1",
3333
"System.Reflection.Extensions": "4.0.1",
34-
"System.Linq.Expressions": "4.1.0"
34+
"System.Linq.Expressions": "4.1.0",
35+
"System.Runtime.InteropServices.RuntimeInformation" : "4.0.0"
3536
}
3637
},
3738
"netstandard1.3": {

tests/ServiceStack.Text.Tests/StringExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void Can_LastLeftPart_and_LastRightPart_string_needle()
101101
}
102102

103103
private static readonly char DirSep = Path.DirectorySeparatorChar;
104-
private static readonly char AltDirSep = Path.DirectorySeparatorChar == '/' ? '\\' : '/';
104+
private static readonly char AltDirSep = '/';
105105

106106
[Test]
107107
public void Does_get_ParentDirectory()

0 commit comments

Comments
 (0)