Files
better-genshin-impact/Build/MicaSetup/Helper/Setup/PrepareInstallPathHelper.cs

28 lines
750 B
C#

using System;
namespace MicaSetup.Helper;
public static class PrepareInstallPathHelper
{
public static string GetPrepareInstallPath(string keyName, bool preferX86 = false)
{
try
{
UninstallInfo info = RegistyUninstallHelper.Read(keyName);
if (!string.IsNullOrWhiteSpace(info.InstallLocation))
{
return info.InstallLocation;
}
}
catch
{
}
if (preferX86)
{
return Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\" + Option.Current.KeyName;
}
return Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\" + Option.Current.KeyName;
}
}