Thank you
- tattdogg
ProgramFilesX86 requires .NET 4, so I cannot use it.
GetInstallationPath implementation.
ExeSessionProcess.GetExecutablePath() doesn't search in Program Files (x86) directory
diff --git a/dotnet/internal/ExeSessionProcess.cs b/dotnet/internal/ExeSessionProcess.cs
index 99a1d15e..abd4f082 100644
--- a/dotnet/internal/ExeSessionProcess.cs
+++ b/dotnet/internal/ExeSessionProcess.cs
@@ -749,7 +749,8 @@ private string GetExecutablePath()
if (!TryFindExecutableInPath(GetAssemblyPath(), out executablePath) &&
!TryFindExecutableInPath(GetInstallationPath(Registry.CurrentUser), out executablePath) &&
!TryFindExecutableInPath(GetInstallationPath(Registry.LocalMachine), out executablePath) &&
- !TryFindExecutableInPath(GetDefaultInstallationPath(), out executablePath))
+ !TryFindExecutableInPath(GetDefaultInstallationPathOnx64(), out executablePath) &&
+ !TryFindExecutableInPath(GetDefaultInstallationPathOnx86(), out executablePath))
{
throw new SessionLocalException(_session,
string.Format(CultureInfo.CurrentCulture,
@@ -761,10 +762,15 @@ private string GetExecutablePath()
}
}
- private static string GetDefaultInstallationPath()
+ private static string GetDefaultInstallationPathOnx64()
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "WinSCP");
}
+
+ private static string GetDefaultInstallationPathOnx86()
+ {
+ return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "WinSCP");
+ }
private static string GetInstallationPath(RegistryKey rootKey)
{
%PATH% variable:
Environment.GetEnvironmentVariable("PATH")?.Split(';').SingleOrDefault(x => x.EndsWith("\\WinSCP\\"));