Skip to content

Commit 01ac6f8

Browse files
committed
installer: refactor the retrieval of previously chosen options
This change is a companion to the previous refactoring, where recording users' choices was made much more robust. Same here. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent c6a9228 commit 01ac6f8

File tree

1 file changed

+17
-30
lines changed

1 file changed

+17
-30
lines changed

installer/install.iss.in

+17-30
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,18 @@ begin
512512
end;
513513
end;
514514

515+
function ReplayChoice(Key:String,Default:String):String;
516+
begin
517+
// Restore the settings chosen during a previous install.
518+
Result:=GetPreviousData(Key,Default);
519+
520+
// Use settings from the user provided INF.
521+
if ShouldLoadInf then begin
522+
Result:=LoadInfString('Setup',StringChangeEx(Key,' ','',True),Default);
523+
end;
524+
525+
end;
526+
515527
procedure InitializeWizard;
516528
var
517529
PrevPageID:Integer;
@@ -624,12 +636,7 @@ begin
624636
end;
625637

626638
// Restore the setting chosen during a previous install.
627-
Data:=GetPreviousData('Path Option','BashOnly');
628-
629-
// Use settings from the user provided INF.
630-
if ShouldLoadInf then begin
631-
Data:=LoadInfString('Setup','PathOption','BashOnly');
632-
end;
639+
Data:=ReplayChoice('Path Option','BashOnly');
633640

634641
if Data='BashOnly' then begin
635642
RdbPath[GP_BashOnly].Checked:=True;
@@ -737,12 +744,7 @@ begin
737744
end;
738745

739746
// Restore the setting chosen during a previous install.
740-
Data:=GetPreviousData('SSH Option','OpenSSH');
741-
742-
// Use settings from the user provided INF.
743-
if ShouldLoadInf then begin
744-
Data:=LoadInfString('Setup','SSHOption','OpenSSH');
745-
end;
747+
Data:=ReplayChoice('SSH Option','OpenSSH');
746748

747749
if Data='OpenSSH' then begin
748750
RdbSSH[GS_OpenSSH].Checked:=True;
@@ -843,12 +845,7 @@ begin
843845
end;
844846

845847
// Restore the setting chosen during a previous install.
846-
Data:=GetPreviousData('CRLF Option','CRLFAlways');
847-
848-
// Use settings from the user provided INF.
849-
if ShouldLoadInf then begin
850-
Data:=LoadInfString('Setup','CRLFOption','CRLFAlways');
851-
end;
848+
Data:=ReplayChoice('CRLF Option','CRLFAlways');
852849

853850
if Data='LFOnly' then begin
854851
RdbCRLF[GC_LFOnly].Checked:=True;
@@ -924,12 +921,7 @@ begin
924921
end;
925922

926923
// Restore the setting chosen during a previous install.
927-
Data:=GetPreviousData('Bash Terminal Option','MinTTY');
928-
929-
// Use settings from the user provided INF.
930-
if ShouldLoadInf then begin
931-
Data:=LoadInfString('Setup','BashTerminalOption','MinTTY');
932-
end;
924+
Data:=ReplayChoice('Bash Terminal Option','MinTTY');
933925

934926
if Data='MinTTY' then begin
935927
RdbBashTerminal[GB_MinTTY].Checked:=True;
@@ -975,12 +967,7 @@ begin
975967
end;
976968

977969
// Restore the settings chosen during a previous install.
978-
Data:=GetPreviousData('Performance Tweaks FSCache','Disabled');
979-
980-
// Use settings from the user provided INF.
981-
if ShouldLoadInf then begin
982-
Data:=LoadInfString('Setup','PerformanceTweaksFSCache','Disabled');
983-
end;
970+
Data:=ReplayChoice('Performance Tweaks FSCache','Disabled');
984971

985972
if Data='Enabled' then begin
986973
RdbPerfTweaks[GP_FSCache].Checked:=True;

0 commit comments

Comments
 (0)