public static string GetGameRegistryFilePath()
{
RegistryKey key;
if (Environment.Is64BitProcess)
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 244850", false);
else
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 244850", false);
if (key != null)
{
return key.GetValue("InstallLocation") as string;
}
// Backup check, but no choice if the above goes to pot.
// Using the [Software\Valve\Steam\SteamPath] as a base for "\steamapps\common\SpaceEngineers", is unreliable, as the Steam Library is customizable and could be on another drive and directory.
var steamPath = GetSteamFilePath();
if (!string.IsNullOrEmpty(steamPath))
{
return Path.Combine(steamPath, @"SteamApps\common\SpaceEngineers");
}
return null;
}