summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-17 18:52:06 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-17 18:52:06 -0400
commit735893c1d5549915c2874a9e17dc1d9844408710 (patch)
treeea82cf584cd2cd25d214aa4b20ffd4732a2dd2ac /src/SMAPI.Toolkit/Framework
parentbd20c2e1375ed5e32315ef5e292802bccc42f530 (diff)
downloadSMAPI-735893c1d5549915c2874a9e17dc1d9844408710.tar.gz
SMAPI-735893c1d5549915c2874a9e17dc1d9844408710.tar.bz2
SMAPI-735893c1d5549915c2874a9e17dc1d9844408710.zip
add error if player manually installs wrong SMAPI bitness
Diffstat (limited to 'src/SMAPI.Toolkit/Framework')
-rw-r--r--src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
index 8cbd8e51..be0c18ce 100644
--- a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
+++ b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs
@@ -2,6 +2,7 @@ using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
+using System.Reflection;
#if SMAPI_FOR_WINDOWS
using System.Management;
#endif
@@ -48,7 +49,6 @@ namespace StardewModdingAPI.Toolkit.Framework
}
}
-
/// <summary>Get the human-readable OS name and version.</summary>
/// <param name="platform">The current platform.</param>
[SuppressMessage("ReSharper", "EmptyGeneralCatchClause", Justification = "Error suppressed deliberately to fallback to default behaviour.")]
@@ -89,6 +89,13 @@ namespace StardewModdingAPI.Toolkit.Framework
: "StardewValley.exe";
}
+ /// <summary>Get whether an executable is 64-bit.</summary>
+ /// <param name="executablePath">The absolute path to the executable file.</param>
+ public static bool Is64BitAssembly(string executablePath)
+ {
+ return AssemblyName.GetAssemblyName(executablePath).ProcessorArchitecture != ProcessorArchitecture.X86;
+ }
+
/*********
** Private methods