From 9018750eb326c666b5424749ddd51b9a18470265 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 15 Dec 2019 11:27:46 -0500 Subject: fix Linux systems with libhybris-utils installed incorrectly detected as Android (#668) --- src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs | 32 +++++++++++++---------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs') diff --git a/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs b/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs index 6dce5da5..2a01fe4b 100644 --- a/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs +++ b/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs @@ -105,23 +105,27 @@ namespace StardewModdingAPI.Toolkit.Utilities /// private static bool IsRunningAndroid() { - using (Process process = new Process()) + using Process process = new Process { - process.StartInfo.FileName = "getprop"; - process.StartInfo.Arguments = "ro.build.user"; - process.StartInfo.RedirectStandardOutput = true; - process.StartInfo.UseShellExecute = false; - process.StartInfo.CreateNoWindow = true; - try + StartInfo = { - process.Start(); - string output = process.StandardOutput.ReadToEnd(); - return !string.IsNullOrEmpty(output); - } - catch - { - return false; + FileName = "getprop", + Arguments = "ro.build.user", + RedirectStandardOutput = true, + UseShellExecute = false, + CreateNoWindow = true } + }; + + try + { + process.Start(); + string output = process.StandardOutput.ReadToEnd(); + return !string.IsNullOrWhiteSpace(output); + } + catch + { + return false; } } -- cgit