From cc6a139d75dcc683e03a1f8eeb5c6e841eea62b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jurczyk?= Date: Mon, 31 Jul 2023 12:06:12 +0200 Subject: [PATCH] Improved OS detection --- .gitignore | 5 ++++- Core/LocalAdmin.cs | 2 -- IO/Config.cs | 4 ++-- IO/PathManager.cs | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 8dd4607..4e4d424 100644 --- a/.gitignore +++ b/.gitignore @@ -395,4 +395,7 @@ FodyWeavers.xsd *.msp # JetBrains Rider -*.sln.iml \ No newline at end of file +*.sln.iml + +# Rider auto generated files +.idea/ diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index f421c94..d95ab7f 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -595,9 +595,7 @@ private static void SetupExitHandlers() AppDomainHandler.Handler.Setup(); if (OperatingSystem.IsWindows()) - { WindowsHandler.Handler.Setup(); - } else if (OperatingSystem.IsLinux()) { #if LINUX_SIGNALS diff --git a/IO/Config.cs b/IO/Config.cs index 046ccfc..746e999 100644 --- a/IO/Config.cs +++ b/IO/Config.cs @@ -13,8 +13,8 @@ public class Config public bool LaLiveViewUseUtc; public bool LaShowStdoutStderr; - public bool LaNoSetCursor = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); - public bool EnableTrueColor = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + public bool LaNoSetCursor = OperatingSystem.IsLinux(); + public bool EnableTrueColor = OperatingSystem.IsLinux(); public bool EnableLaLogs = true; public bool LaLogsUseUtc; public bool LaLogsUseZForUtc; diff --git a/IO/PathManager.cs b/IO/PathManager.cs index 33c4ee8..0d1effc 100644 --- a/IO/PathManager.cs +++ b/IO/PathManager.cs @@ -45,10 +45,10 @@ private static string GetSpecialFolderPath() { CorrectPathFound = true; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + if (OperatingSystem.IsLinux()) return path + Path.DirectorySeparatorChar + ".config" + Path.DirectorySeparatorChar; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (OperatingSystem.IsWindows()) return path + Path.DirectorySeparatorChar + "AppData" + Path.DirectorySeparatorChar + "Roaming" + Path.DirectorySeparatorChar; ConsoleUtil.WriteLine("Failed to get special folder path - unsupported platform!", ConsoleColor.Red);