0
0
mirror of https://github.com/sp-tarkov/installer.git synced 2025-02-13 02:10:47 -05:00
installer/Aki.Helper/GameHelper.cs
2022-05-13 22:41:15 +01:00

24 lines
807 B
C#

using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.IO;
namespace Installer.Aki.Helper
{
public static class GameHelper
{
private const string registryInstall = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
public static string DetectOriginalGamePath()
{
// We can't detect the installed path on non-Windows
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return null;
var uninstallStringValue = Registry.LocalMachine.OpenSubKey(registryInstall, false)
?.GetValue("UninstallString");
var info = (uninstallStringValue is string key) ? new FileInfo(key) : null;
return info?.DirectoryName;
}
}
}