fix Linux systems with libhybris-utils installed incorrectly detected as Android (#668)

This commit is contained in:
Jesse Plamondon-Willard 2019-12-15 11:27:46 -05:00
parent 4711d19b3e
commit 9018750eb3
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 19 additions and 14 deletions

View File

@ -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:

View File

@ -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;
}
}