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

Commit dc604a0

Browse files
committed
Add Env.HasMultiplePlatformTargets
1 parent 9e981df commit dc604a0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/ServiceStack.Text/Env.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static Env()
5757
IsWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
5858
IsOSX = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX);
5959
IsUnix = IsOSX || IsLinux;
60+
HasMultiplePlatformTargets = true;
6061
#elif NET45
6162
var platform = (int)Environment.OSVersion.Platform;
6263
IsUnix = platform == 4 || platform == 6 || platform == 128;
@@ -107,6 +108,8 @@ static Env()
107108

108109
public static string ServerUserAgent { get; set; }
109110

111+
public static bool HasMultiplePlatformTargets { get; set; }
112+
110113
private static readonly DateTime __releaseDate;
111114
public static DateTime GetReleaseDate()
112115
{

src/ServiceStack.Text/PathUtils.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ public static string MapAbsolutePath(this string relativePath, string appendPart
2828
public static string MapProjectPath(this string relativePath)
2929
{
3030
var sep = PclExport.Instance.DirSep;
31-
#if !NETSTANDARD1_1
32-
return PclExport.Instance.MapAbsolutePath(relativePath, $"{sep}..{sep}..");
33-
#else
34-
return PclExport.Instance.MapAbsolutePath(relativePath, $"{sep}..{sep}..{sep}..");
35-
#endif
31+
return Env.HasMultiplePlatformTargets
32+
? PclExport.Instance.MapAbsolutePath(relativePath, $"{sep}..{sep}..{sep}..")
33+
: PclExport.Instance.MapAbsolutePath(relativePath, $"{sep}..{sep}..");
3634
}
3735
/// <summary>
3836
/// Maps the path of a file in the context of a VS 2017+ multi-platform project in a Console App

0 commit comments

Comments
 (0)