diff --git a/build/Build.cs b/build/Build.cs
index e1f29b7b..b07b1881 100644
--- a/build/Build.cs
+++ b/build/Build.cs
@@ -62,6 +62,7 @@ namespace LibHacBuild
private const string MyGetSource = "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json";
const string CertFileName = "cert.pfx";
+ private const string CoreFrameworks = "netcoreapp2.1;netstandard2.0";
private bool IsMasterBranch => _gitVersion?.BranchName.Equals("master") ?? false;
@@ -139,7 +140,7 @@ namespace LibHacBuild
.SetProperties(VersionProps)
.SetProperty("BuildType", "Release");
- if (DoCoreBuildOnly) buildSettings = buildSettings.SetFramework("netcoreapp2.1");
+ if (DoCoreBuildOnly) buildSettings = buildSettings.SetProperty("TargetFrameworks", CoreFrameworks);
DotNetBuild(s => buildSettings);
@@ -186,7 +187,7 @@ namespace LibHacBuild
.SetProperties(VersionProps);
if (DoCoreBuildOnly)
- settings = settings.SetProperty("TargetFrameworks", "netcoreapp2.1");
+ settings = settings.SetProperty("TargetFrameworks", CoreFrameworks);
DotNetPack(s => settings);
@@ -241,7 +242,7 @@ namespace LibHacBuild
.EnableNoBuild()
.SetConfiguration(Configuration);
- if (DoCoreBuildOnly) settings = settings.SetFramework("netcoreapp2.1");
+ if (DoCoreBuildOnly) settings = settings.SetProperty("TargetFrameworks", CoreFrameworks);
DotNetTest(s => settings);
});
diff --git a/build/_build.csproj b/build/_build.csproj
index fb9eddc5..2786a599 100644
--- a/build/_build.csproj
+++ b/build/_build.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/LibHac/Compatibility/FileSystemName.cs b/src/LibHac/Compatibility/FileSystemName.cs
index 040962b3..07f9059a 100644
--- a/src/LibHac/Compatibility/FileSystemName.cs
+++ b/src/LibHac/Compatibility/FileSystemName.cs
@@ -1,5 +1,5 @@
-#if NETFRAMEWORK
+#if !HAS_FILE_SYSTEM_NAME
// This code was introduced in .NET Core 2.1
diff --git a/src/LibHac/Fs/ConcatenationDirectory.cs b/src/LibHac/Fs/ConcatenationDirectory.cs
index 4f53f5b0..770563f1 100644
--- a/src/LibHac/Fs/ConcatenationDirectory.cs
+++ b/src/LibHac/Fs/ConcatenationDirectory.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-#if NETCOREAPP
+#if CROSS_PLATFORM
using System.Runtime.InteropServices;
#endif
@@ -64,7 +64,7 @@ namespace LibHac.Fs
private bool IsConcatenationFile(DirectoryEntry entry)
{
-#if NETCOREAPP
+#if CROSS_PLATFORM
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return ConcatenationFileSystem.HasConcatenationFileAttribute(entry.Attributes);
diff --git a/src/LibHac/Fs/ConcatenationFileSystem.cs b/src/LibHac/Fs/ConcatenationFileSystem.cs
index 9d1c8273..fb242849 100644
--- a/src/LibHac/Fs/ConcatenationFileSystem.cs
+++ b/src/LibHac/Fs/ConcatenationFileSystem.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-#if NETCOREAPP
+#if CROSS_PLATFORM
using System.Runtime.InteropServices;
#endif
@@ -51,7 +51,7 @@ namespace LibHac.Fs
// but writing still won't work properly on those platforms
internal bool IsConcatenationFile(string path)
{
-#if NETCOREAPP
+#if CROSS_PLATFORM
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return HasConcatenationFileAttribute(BaseFileSystem.GetFileAttributes(path));
@@ -65,7 +65,7 @@ namespace LibHac.Fs
#endif
}
-#if NETCOREAPP
+#if CROSS_PLATFORM
private bool IsConcatenationFileHeuristic(string path)
{
if (BaseFileSystem.GetEntryType(path) != DirectoryEntryType.Directory) return false;
diff --git a/src/LibHac/Fs/PathTools.cs b/src/LibHac/Fs/PathTools.cs
index 0b3c4b6a..97dc2a76 100644
--- a/src/LibHac/Fs/PathTools.cs
+++ b/src/LibHac/Fs/PathTools.cs
@@ -2,7 +2,7 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
-#if !NETFRAMEWORK
+#if HAS_FILE_SYSTEM_NAME
using System.IO.Enumeration;
#endif
@@ -430,11 +430,11 @@ namespace LibHac.Fs
public static bool MatchesPattern(string searchPattern, string name, bool ignoreCase)
{
-#if NETFRAMEWORK
- return Compatibility.FileSystemName.MatchesSimpleExpression(searchPattern.AsSpan(),
- name.AsSpan(), ignoreCase);
-#else
+#if HAS_FILE_SYSTEM_NAME
return FileSystemName.MatchesSimpleExpression(searchPattern.AsSpan(),
+ name.AsSpan(), ignoreCase);
+#else
+ return Compatibility.FileSystemName.MatchesSimpleExpression(searchPattern.AsSpan(),
name.AsSpan(), ignoreCase);
#endif
}
diff --git a/src/LibHac/LibHac.csproj b/src/LibHac/LibHac.csproj
index 28b7057e..d1e6fccc 100644
--- a/src/LibHac/LibHac.csproj
+++ b/src/LibHac/LibHac.csproj
@@ -2,7 +2,7 @@
Library
- netcoreapp2.1;net46
+ netcoreapp2.1;netstandard2.0;net46
7.3
@@ -30,16 +30,24 @@
- $(DefineConstants);STREAM_SPAN
+ $(DefineConstants);STREAM_SPAN;STRING_SPAN;HAS_FILE_SYSTEM_NAME;CROSS_PLATFORM
+
+
+
+ $(DefineConstants);CROSS_PLATFORM
-
+
+
+
+
+
diff --git a/src/LibHac/Util.cs b/src/LibHac/Util.cs
index a4a5e1c6..d9f1a5e0 100644
--- a/src/LibHac/Util.cs
+++ b/src/LibHac/Util.cs
@@ -109,10 +109,10 @@ namespace LibHac
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string GetUtf8String(ReadOnlySpan value)
{
-#if NETFRAMEWORK
- return Encoding.UTF8.GetString(value.ToArray());
-#else
+#if STRING_SPAN
return Encoding.UTF8.GetString(value);
+#else
+ return Encoding.UTF8.GetString(value.ToArray());
#endif
}
@@ -123,10 +123,10 @@ namespace LibHac
value = value.Slice(0, i);
-#if NETFRAMEWORK
- return Encoding.UTF8.GetString(value.ToArray());
-#else
+#if STRING_SPAN
return Encoding.UTF8.GetString(value);
+#else
+ return Encoding.UTF8.GetString(value.ToArray());
#endif
}
diff --git a/tests/LibHac.Tests/LibHac.Tests.csproj b/tests/LibHac.Tests/LibHac.Tests.csproj
index 74d1a8ce..fa70a93c 100644
--- a/tests/LibHac.Tests/LibHac.Tests.csproj
+++ b/tests/LibHac.Tests/LibHac.Tests.csproj
@@ -7,9 +7,9 @@
-
-
-
+
+
+