Fix PlatformIdentifier not having a compiler guard

This commit is contained in:
Dominion
2023-04-14 21:02:46 -04:00
parent b06647d28b
commit 80dbeb3611
3 changed files with 6 additions and 3 deletions
@@ -295,7 +295,6 @@ namespace Tgstation.Server.Host.Core
services.AddSingleton<IPasswordHasher<Models.User>, PasswordHasher<Models.User>>();
// configure platform specific services
#pragma warning disable CA1416 // Validate platform compatibility
if (postSetupServices.PlatformIdentifier.IsWindows)
{
AddWatchdog<WindowsWatchdogFactory>(services, postSetupServices);
@@ -325,7 +324,6 @@ namespace Tgstation.Server.Host.Core
services.AddSingleton<IHostedService, PosixSignalHandler>();
}
#pragma warning restore CA1416 // Validate platform compatibility
// configure component/misc services
services.AddScoped<IPortAllocator, PortAllocator>();
@@ -1,4 +1,6 @@
namespace Tgstation.Server.Host.System
using System.Runtime.Versioning;
namespace Tgstation.Server.Host.System
{
/// <summary>
/// For identifying the current platform.
@@ -8,6 +10,7 @@
/// <summary>
/// If the current platform is a Windows platform.
/// </summary>
[SupportedOSPlatformGuard("windows")]
bool IsWindows { get; }
/// <summary>
@@ -1,4 +1,5 @@
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Tgstation.Server.Host.System
{
@@ -6,6 +7,7 @@ namespace Tgstation.Server.Host.System
sealed class PlatformIdentifier : IPlatformIdentifier
{
/// <inheritdoc />
[SupportedOSPlatformGuard("windows")]
public bool IsWindows { get; }
/// <inheritdoc />