build/windows: Organize *gimp3264.iss [Code] to not look like Assembly

The installer is probably the most complex packaging format so one of the
biggest examples of packaging love over the years into it in our repo.
But the readability of installer scripts... leave a lot to be desired.

Now, the main script is organized following the order of installer pages
with some comments. This will make easier to future contributors work
(but this commit probably isn't perfect since it's a big change to read)
This commit is contained in:
Bruno 2024-06-02 10:25:03 -03:00
parent 09d6402a5b
commit fad40afe45
No known key found for this signature in database
3 changed files with 914 additions and 920 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,8 @@ begin
Result := S + ' /' + P;
end;
const
RunOnceName = 'Resume GIMP {#GIMP_VERSION} install';
procedure CreateRunOnceEntry;
var RunOnceData, SetupRestartData: String;
@ -79,7 +81,7 @@ begin
RegDeleteKeyIncludingSubkeys(HKLM, 'Software\' + RunOnceName); //clean up
if not Exec('>',CmdLine,'',SW_SHOW,ewNoWait,ResultCode) then //bonus: don't block shell from loading, since RunOnce installer exits immediately
MsgBox(FmtMessage(CustomMessage('ErrorRestartingSetup'),[IntToStr(ResultCode)]), mbError, mb_Ok);
DebugMsg('RestartMyself','Result of running ' + CmdLine + ': ' + IntToStr(ResultCode));
end else

View File

@ -2,6 +2,9 @@
[Code]
#endif
var
asUninstInf: TArrayOfString; //uninst.inf contents (loaded at start of uninstall, executed at the end)
function SplitRegParams(const pInf: String; var oRootKey: Integer; var oKey,oValue: String): Boolean;
var sRootKey: String;
d: Integer;
@ -128,7 +131,7 @@ begin
Left := (frmMessage.ClientWidth - Width) div 2;
Visible := True;
end;
frmMessage.Show();
frmMessage.Refresh();
@ -138,7 +141,7 @@ end;
procedure UninstInfRun(const pInf: String);
var Description,Prog,Params: String;
Split, ResultCode, Ctr: Integer;
frmMessage: TForm;
frmMessage: TForm;
begin
DebugMsg('UninstInfRun',pInf);
@ -171,7 +174,7 @@ begin
if Exec(Prog,Params,'',SW_SHOW,ewWaitUntilTerminated,ResultCode) then
begin
DebugMsg('UninstInfRun','Exec result: ' + IntToStr(ResultCode));
Ctr := 0;
while FileExists(Prog) do //wait a few seconds for the uninstaller to be deleted - since this is done by a program
begin //running from a temporary directory, the uninstaller we ran above will exit some time before
@ -316,7 +319,7 @@ begin
Inc(countUI);
continue;
end;
end;
//something else, keep for new uninst.inf
@ -329,7 +332,7 @@ begin
SetArrayLength(asUninstInf, countUI);
SaveStringsToUTF8File(ExpandConstant('{app}\uninst\uninst.inf'), asNew, False); //replace uninst.inf with a cleaned one
ParseUninstInf(); //remove old associations
end;
end;