Skip to content

Fixed search path on x64 systems #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dotnet/internal/ExeSessionProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
{
Expand Down