From 785d190e50220a1a44e1f3c7da2f344203b1b729 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 15 Jul 2019 15:43:33 +0100 Subject: [PATCH] Detect Windows Subsystem for Linux. --- Interop/DetectOS.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Interop/DetectOS.cs b/Interop/DetectOS.cs index 86f2dbe5b..cc5843690 100644 --- a/Interop/DetectOS.cs +++ b/Interop/DetectOS.cs @@ -246,7 +246,13 @@ namespace DiscImageChef.CommonTypes.Interop case PlatformID.Hurd: return "Hurd"; case PlatformID.iOS: return "iOS"; case PlatformID.IRIX: return "IRIX"; - case PlatformID.Linux: return "Linux"; + case PlatformID.Linux: + if(!File.Exists("/proc/version")) return "Linux"; + + string s = File.ReadAllText("/proc/version"); + + return s.Contains("Microsoft") || s.Contains("WSL") ? "Windows Subsystem for Linux" : "Linux"; + case PlatformID.MacOSX: if(string.IsNullOrEmpty(version)) return "macOS";