Installer: Prefer custom GIT_SSH over previous data for Plink
authorSebastian Schuberth <sschuberth@gmail.com>
Sun, 2 Jun 2013 09:54:28 +0000 (2 11:54 +0200)
committerSebastian Schuberth <sschuberth@gmail.com>
Sun, 2 Jun 2013 10:09:29 +0000 (2 12:09 +0200)
In case the user has modified GIT_SSH manually after the last
installation, prefer that path over the one from the previous
installation for the Plink location in case it points to a valid
Plink executable.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
share/WinGit/install.iss

index eeb5a3d..a087eae 100644 (file)
@@ -374,7 +374,7 @@ var
     PrevPageID:Integer;\r
     LblGitBash,LblGitCmd,LblGitCmdTools,LblGitCmdToolsWarn:TLabel;\r
     LblOpenSSH,LblPlink:TLabel;\r
-    PuTTYSessions:TArrayOfString;\r
+    PuTTYSessions,EnvSSH:TArrayOfString;\r
     LblLFOnly,LblCRLFAlways,LblCRLFCommitAsIs:TLabel;\r
     BtnPlink:TButton;\r
     Data:String;\r
@@ -554,13 +554,21 @@ begin
         EdtPlink:=TEdit.Create(PuTTYPage);\r
         with EdtPlink do begin\r
             Parent:=PuTTYPage.Surface;\r
-            Text:=GetPreviousData('Plink Path','');\r
+\r
+            EnvSSH:=GetEnvStrings('GIT_SSH',IsAdminLoggedOn);\r
+            if (GetArrayLength(EnvSSH)=1) and (Pos('plink',LowerCase(EnvSSH[0]))>0) then begin\r
+                Text:=EnvSSH[0];\r
+            end;\r
+            if not FileExists(Text) then begin\r
+                Text:=GetPreviousData('Plink Path','');\r
+            end;\r
             if not FileExists(Text) then begin\r
                 Text:=GuessPlinkExecutable;\r
             end;\r
             if not FileExists(Text) then begin\r
                 Text:='';\r
             end;\r
+\r
             Left:=ScaleX(28);\r
             Top:=ScaleY(161);\r
             Width:=ScaleX(316);\r