Skip to content
Open
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions WinSCP/winscp.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ def _detect_distro_official(self, given_enabled, given_label, given_path, given_



def _autodetect_official_installreg(self):
def _exe_from_reg(self, reg_root):
try:
key = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
reg_root,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\winscp3_is1",
access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY)
value = winreg.QueryValueEx(key, "InstallLocation")[0]
Expand All @@ -282,6 +282,11 @@ def _autodetect_official_installreg(self):
pass
return None

def _autodetect_official_installreg(self):
hklm = self._exe_from_reg(winreg.HKEY_LOCAL_MACHINE)
return (hklm if hklm is not None
else self._exe_from_reg(winreg.HKEY_CURRENT_USER))

def _autodetect_official_progfiles(self):
for hive in ('%PROGRAMFILES%', '%PROGRAMFILES(X86)%'):
exe_file = os.path.join(
Expand Down