// Copyright (C) 2024 Intro-Skipper contributors // SPDX-License-Identifier: GPL-3.0-only. using System.IO; using System.Runtime.InteropServices; namespace IntroSkipper.Helper { /// /// Provides methods to determine the operating system. /// public static class OperatingSystem { /// /// Determines if the current operating system is Windows. /// /// True if the current operating system is Windows; otherwise, false. public static bool IsWindows() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); /// /// Determines if the current operating system is macOS. /// /// True if the current operating system is macOS; otherwise, false. public static bool IsMacOS() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); /// /// Determines if the current operating system is Linux. /// /// True if the current operating system is Linux; otherwise, false. public static bool IsLinux() => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); /// /// Determines if the current environment is running in Docker. /// /// True if running in a Docker container; otherwise, false. public static bool IsDocker() => File.Exists("/.dockerenv") || File.Exists("/run/.containerenv"); } }