aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common/Compute.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-06-02 21:51:07 -0500
committerGitHub <noreply@github.com>2026-06-02 21:51:07 -0500
commit2e3fd1d2f66a9f5ec2b1ec80d6c19348529cab63 (patch)
tree0fdd79df6641aa99ec2bbabc8113f16d5bc0d164 /src/slskd/Common/Compute.cs
parent0c25a725360ba67a12ed07eee056256eec408f27 (diff)
parent3d76c437f63048c83b426a728ba37043115631f6 (diff)
downloadslskd-2e3fd1d2f66a9f5ec2b1ec80d6c19348529cab63.tar.gz
Merge pull request #1749 from slskd/files
Add comprehensive cross-platform path and filename handling functions
Diffstat (limited to 'src/slskd/Common/Compute.cs')
-rw-r--r--src/slskd/Common/Compute.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/slskd/Common/Compute.cs b/src/slskd/Common/Compute.cs
index 8d7c1ceb..dc565806 100644
--- a/src/slskd/Common/Compute.cs
+++ b/src/slskd/Common/Compute.cs
@@ -33,6 +33,7 @@
namespace slskd
{
using System;
+ using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
@@ -64,5 +65,25 @@ namespace slskd
using var sha256 = SHA256.Create();
return BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty);
}
+
+ public static OSPlatform OSPlatform()
+ {
+ if (OperatingSystem.IsWindows())
+ {
+ return System.Runtime.InteropServices.OSPlatform.Windows;
+ }
+
+ if (OperatingSystem.IsMacOS())
+ {
+ return System.Runtime.InteropServices.OSPlatform.OSX;
+ }
+
+ if (OperatingSystem.IsFreeBSD())
+ {
+ return System.Runtime.InteropServices.OSPlatform.FreeBSD;
+ }
+
+ return System.Runtime.InteropServices.OSPlatform.Linux;
+ }
}
} \ No newline at end of file