tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
PlatformIdentifier.cs
Go to the documentation of this file.
1using System;
2using System.Runtime.InteropServices;
3using System.Runtime.Versioning;
4
6{
9 {
11 [SupportedOSPlatformGuard("windows")]
12 public bool IsWindows { get; }
13
15 public string ScriptFileExtension { get; }
16
21 {
22 IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
23 ScriptFileExtension = IsWindows ? "bat" : "sh";
24 }
25
27 public string NormalizePath(string path)
28 {
29 ArgumentNullException.ThrowIfNull(path);
30 if (IsWindows)
31 path = path.Replace('\\', '/');
32
33 return path;
34 }
35 }
36}
string NormalizePath(string path)
Normalize a path for consistency.The normalized path.
PlatformIdentifier()
Initializes a new instance of the PlatformIdentifier class.
bool IsWindows
If the current platform is a Windows platform.
string ScriptFileExtension
The extension of executable script files for the system.
For identifying the current platform.