diff options
| author | Nyanmisaka <nst799610810@gmail.com> | 2020-04-06 20:13:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-06 20:13:05 +0800 |
| commit | 645363810370504361cecd5ce4c529343ed28833 (patch) | |
| tree | 524ce17ae7d83415b6f8fffac58efbaf806db137 /MediaBrowser.Common/System/OperatingSystem.cs | |
| parent | 20ac3c36e22739402923a9fd5b2ac06f9c604c5a (diff) | |
| parent | 0cd7cd611e6118b8dac31cf3c6861509f2b33c56 (diff) | |
Merge pull request #1 from jellyfin/master
Diffstat (limited to 'MediaBrowser.Common/System/OperatingSystem.cs')
| -rw-r--r-- | MediaBrowser.Common/System/OperatingSystem.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/MediaBrowser.Common/System/OperatingSystem.cs b/MediaBrowser.Common/System/OperatingSystem.cs index f23af4799..5f673d320 100644 --- a/MediaBrowser.Common/System/OperatingSystem.cs +++ b/MediaBrowser.Common/System/OperatingSystem.cs @@ -1,5 +1,4 @@ #pragma warning disable CS1591 -#pragma warning disable SA1600 using System; using System.Runtime.InteropServices; @@ -36,7 +35,7 @@ namespace MediaBrowser.Common.System case OperatingSystemId.Linux: return "Linux"; case OperatingSystemId.Darwin: return "macOS"; case OperatingSystemId.Windows: return "Windows"; - default: throw new Exception($"Unknown OS {Id}"); + default: throw new PlatformNotSupportedException($"Unknown OS {Id}"); } } } @@ -54,20 +53,20 @@ namespace MediaBrowser.Common.System default: { string osDescription = RuntimeInformation.OSDescription; - if (osDescription.IndexOf("linux", StringComparison.OrdinalIgnoreCase) != -1) + if (osDescription.Contains("linux", StringComparison.OrdinalIgnoreCase)) { return OperatingSystemId.Linux; } - else if (osDescription.IndexOf("darwin", StringComparison.OrdinalIgnoreCase) != -1) + else if (osDescription.Contains("darwin", StringComparison.OrdinalIgnoreCase)) { return OperatingSystemId.Darwin; } - else if (osDescription.IndexOf("bsd", StringComparison.OrdinalIgnoreCase) != -1) + else if (osDescription.Contains("bsd", StringComparison.OrdinalIgnoreCase)) { return OperatingSystemId.BSD; } - throw new Exception($"Can't resolve OS with description: '{osDescription}'"); + throw new PlatformNotSupportedException($"Can't resolve OS with description: '{osDescription}'"); } } } |
