diff --git a/ArchiSteamFarm/Core/ASF.cs b/ArchiSteamFarm/Core/ASF.cs index 64ea44aeb..df984d7ca 100644 --- a/ArchiSteamFarm/Core/ASF.cs +++ b/ArchiSteamFarm/Core/ASF.cs @@ -377,7 +377,11 @@ namespace ArchiSteamFarm.Core { return null; } +#if NETFRAMEWORK if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#else + if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#endif string executable = Path.Combine(SharedInfo.HomeDirectory, SharedInfo.AssemblyName); if (File.Exists(executable)) { diff --git a/ArchiSteamFarm/Core/OS.cs b/ArchiSteamFarm/Core/OS.cs index a76f20ccb..04d008116 100644 --- a/ArchiSteamFarm/Core/OS.cs +++ b/ArchiSteamFarm/Core/OS.cs @@ -141,8 +141,12 @@ namespace ArchiSteamFarm.Core { throw new ArgumentNullException(nameof(path)); } +#if NETFRAMEWORK if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && !RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - return; +#else + if (!RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) && !RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && !RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#endif + throw new PlatformNotSupportedException(); } if (!File.Exists(path) && !Directory.Exists(path)) { @@ -201,7 +205,7 @@ namespace ArchiSteamFarm.Core { private static void WindowsDisableQuickEditMode() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - return; + throw new PlatformNotSupportedException(); } IntPtr consoleHandle = NativeMethods.GetStdHandle(NativeMethods.StandardInputHandle); @@ -221,7 +225,7 @@ namespace ArchiSteamFarm.Core { private static void WindowsKeepSystemActive() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - return; + throw new PlatformNotSupportedException(); } // This function calls unmanaged API in order to tell Windows OS that it should not enter sleep state while the program is running diff --git a/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs b/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs index 50de67afb..01600eb9a 100644 --- a/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs +++ b/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs @@ -174,7 +174,11 @@ namespace ArchiSteamFarm.Helpers { // Non-critical, user might have no rights to manage the resource ASF.ArchiLogger.LogGenericDebuggingException(e); } - } else { +#if NETFRAMEWORK + } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#else + } else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#endif OS.UnixSetFileAccess(directoryPath!, OS.EUnixPermission.Combined777); } } @@ -195,7 +199,11 @@ namespace ArchiSteamFarm.Helpers { // Non-critical, user might have no rights to manage the resource ASF.ArchiLogger.LogGenericDebuggingException(e); } - } else { +#if NETFRAMEWORK + } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#else + } else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { +#endif OS.UnixSetFileAccess(FilePath, OS.EUnixPermission.Combined777); } } catch (IOException) {