Update method for retrieving installer path

The method 'GetInstallerPath' in 'Configuration.cs' has been updated to check both 32-bit and 64-bit registry paths for the 'SubtitleEdit_is1' uninstall key. This was changed to enhance compatibility with different system architectures, ensuring that the correct path is found in both scenarios. Changes involve replacing separate read commands with an array of paths and a loop to sift through them.
This commit is contained in:
Ivandro Jao 2023-07-18 18:33:43 +01:00
parent 96b8794b82
commit e7c7c300cf

View File

@ -120,16 +120,18 @@ namespace Nikse.SubtitleEdit.Core.Common
private static string GetInstallerPath()
{
const string valueName = "InstallLocation";
var value = RegistryUtil.GetValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1", valueName);
if (value != null && Directory.Exists(value))
{
return value;
}
string[] paths = {
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1",
@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1"
};
value = RegistryUtil.GetValue(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1", valueName);
if (value != null && Directory.Exists(value))
foreach (var path in paths)
{
return value;
var value = RegistryUtil.GetValue(path, valueName);
if (Directory.Exists(value))
{
return value;
}
}
return null;