diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-12-15 11:27:46 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-12-15 11:27:46 -0500 |
commit | 9018750eb326c666b5424749ddd51b9a18470265 (patch) | |
tree | 585a93b2cec5aac6f7cb8c0746a4db719ac20d54 | |
parent | 4711d19b3e3fa71c304100209450c530a0e5c51a (diff) | |
download | SMAPI-9018750eb326c666b5424749ddd51b9a18470265.tar.gz SMAPI-9018750eb326c666b5424749ddd51b9a18470265.tar.bz2 SMAPI-9018750eb326c666b5424749ddd51b9a18470265.zip |
fix Linux systems with libhybris-utils installed incorrectly detected as Android (#668)
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs | 32 |
2 files changed, 19 insertions, 14 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 217b0f34..8e1b9f1c 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,7 @@ * Added friendly log message for save file-not-found errors. * Updated for the 'Force Off' gamepad mode added in Stardew Valley 1.4.1. * Fixed compatibility with Linux Mint 18 (thanks to techge!) and Arch Linux. + * Fixed compatibility with Linux systems which have libhybris-utils installed. * Internal optimizations. * For modders: 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 /// </remarks> 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; } } |