Installer: Set OutputDir correctly even if compiling from within the IDE
[msysgit.git] / share / WinGit / putty.inc.iss
blob2d28fa0bf4d8060ad961504f539a95408b18a3fc
1 const
2 TortoiseSVNInstallKey='SOFTWARE\TortoiseSVN';
3 TortoiseCVSUninstallKey='SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TortoiseCVS_is1';
4 PuTTYUninstallKey='SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PuTTY_is1';
5 PuTTYPrivateKeyAssoc='PuTTYPrivateKey\shell\open\command';
7 // Tries to detect the path to a PuTTY installation / an application that comes
8 // with an improved version of Plink. TortoisePlink from TortoiseSVN features a
9 // GUI dialog to accept new host keys, for example.
10 function GetPuTTYLocation:string;
11 begin
12 // Prefer TortoisePlink over vanilla Plink for its GUI dialog to accept host keys.
13 if (IsWin64 and RegQueryStringValue(HKEY_LOCAL_MACHINE_64,TortoiseSVNInstallKey,'Directory',Result)) or
14 RegQueryStringValue(HKEY_LOCAL_MACHINE_32,TortoiseSVNInstallKey,'Directory',Result) then begin
15 // C:\Program Files\TortoiseSVN\
16 Result:=Result+'bin\';
17 // C:\Program Files\TortoiseSVN\bin\
18 end else begin
19 if not (IsWin64 and RegQueryStringValue(HKEY_LOCAL_MACHINE_64,TortoiseCVSUninstallKey,'InstallLocation',Result)) then begin
20 RegQueryStringValue(HKEY_LOCAL_MACHINE_32,TortoiseCVSUninstallKey,'InstallLocation',Result);
21 end;
22 // C:\Program Files\TortoiseCVS\
23 end;
25 if DirExists(Result) then begin
26 Result:=Result+'TortoisePlink.exe'
27 Exit;
28 end;
30 if not RegQueryStringValue(HKEY_LOCAL_MACHINE,PuTTYUninstallKey,'InstallLocation',Result) then begin
31 if RegQueryStringValue(HKEY_CLASSES_ROOT,PuTTYPrivateKeyAssoc,'',Result) then begin
32 // "C:\Program Files\PuTTY\pageant.exe" "%1"
33 Result:=RemoveQuotes(Result);
34 // C:\Program Files\PuTTY\pageant.exe" "%1
35 Result:=ExtractFilePath(Result);
36 end;
37 end;
38 // C:\Program Files\PuTTY\
40 if not DirExists(Result) then begin
41 // Guess something.
42 Result:=ExpandConstant('{pf}\PuTTY\');
43 end;
45 Result:=Result+'plink.exe'
46 end;