Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit e26b03c

Browse files
committed
Condense scripted constant functions into macro definitions
1 parent 1383f48 commit e26b03c

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

ElixirWeb.iss

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
#include <idp.iss>
2525

26+
#define StrInspectSignature(str Value) 'Const_' + StringChange(Value, '.', '__')
27+
#define StrInspectScriptConst(str Value) '{code:' + StrInspectSignature(Value) + '}'
28+
#define StrInspectFuncDef(str Value) 'function ' + StrInspectSignature(Value) + '(Param: String): String; begin Result := ' + Value + '; end;'
29+
2630
[Setup]
2731
AppName=Elixir
2832
AppVersion=0.57
@@ -58,18 +62,18 @@ Source: "compiler:Setup.e32"; DestDir: "{tmp}"; Flags: deleteafterinstall
5862
Source: "compiler:SetupLdr.e32"; DestDir: "{tmp}"; Flags: deleteafterinstall
5963

6064
[Run]
61-
Filename: "{tmp}\{code:ConstGetErlangExe32}"; Flags: hidewizard; StatusMsg: "Installing {code:ConstGetErlangName32}..."; Tasks: erlang\32
62-
Filename: "{tmp}\{code:ConstGetErlangExe64}"; Flags: hidewizard; StatusMsg: "Installing {code:ConstGetErlangName64}..."; Tasks: erlang\64
65+
Filename: "{tmp}\{#StrInspectScriptConst('GlobalErlangData.Exe32')}"; Flags: hidewizard; StatusMsg: "Installing {#StrInspectScriptConst('GlobalErlangData.Name32')}..."; Tasks: erlang\32
66+
Filename: "{tmp}\{#StrInspectScriptConst('GlobalErlangData.Exe64')}"; Flags: hidewizard; StatusMsg: "Installing {#StrInspectScriptConst('GlobalErlangData.Name64')}..."; Tasks: erlang\64
6367
Filename: "{tmp}\7za.exe"; Parameters: "x -oelixir Precompiled.zip"; WorkingDir: "{tmp}"; StatusMsg: "Extracting Precompiled.zip archive..."
64-
Filename: "{tmp}\ISCC.exe"; Parameters: "/dElixirVersion={code:ConstGetSelectedReleaseVersion} /dSkipWelcome /dNoCompression Elixir.iss"; WorkingDir: "{tmp}"; StatusMsg: "Compiling Elixir installer..."
65-
Filename: "{tmp}\Output\elixir-v{code:ConstGetSelectedReleaseVersion}-setup.exe"; Flags: nowait; StatusMsg: "Starting Elixir installer..."
68+
Filename: "{tmp}\ISCC.exe"; Parameters: "/dElixirVersion={#StrInspectScriptConst('CacheSelectedRelease.Version')} /dSkipWelcome /dNoCompression Elixir.iss"; WorkingDir: "{tmp}"; StatusMsg: "Compiling Elixir installer..."
69+
Filename: "{tmp}\Output\elixir-v{#StrInspectScriptConst('CacheSelectedRelease.Version')}-setup.exe"; Flags: nowait; StatusMsg: "Starting Elixir installer..."
6670

6771
[Tasks]
6872
Name: "erlang"; Description: "Install Erlang"; Check: CheckToInstallErlang
69-
Name: "erlang\32"; Description: "{code:ConstGetErlangName32}"; Flags: exclusive
70-
Name: "erlang\64"; Description: "{code:ConstGetErlangName64}"; Flags: exclusive; Check: IsWin64
73+
Name: "erlang\32"; Description: "{#StrInspectScriptConst('GlobalErlangData.Name32')}"; Flags: exclusive
74+
Name: "erlang\64"; Description: "{#StrInspectScriptConst('GlobalErlangData.Name64')}"; Flags: exclusive; Check: IsWin64
7175
Name: "erlang\newpath"; Description: "Append Erlang directory to Path environment variable"
72-
Name: "existingpath"; Description: "Append {code:ConstGetLatestErlangPath}\bin to Path environment variable"; Check: CheckToAddExistingErlangPath
76+
Name: "existingpath"; Description: "Append {#StrInspectScriptConst('GetLatestErlangPath')}\bin to Path environment variable"; Check: CheckToAddExistingErlangPath
7377

7478
[Code]
7579
#include "src\util.iss"
@@ -187,16 +191,10 @@ function CheckToInstallErlang: Boolean; begin
187191
Result := (GetLatestErlangPath = ''); end;
188192
function CheckToAddExistingErlangPath: Boolean; begin
189193
Result := (not CheckToInstallErlang) and (not ErlangInPath); end;
190-
191-
function ConstGetErlangName32(Param: String): String; begin
192-
Result := GlobalErlangData.Name32; end;
193-
function ConstGetErlangName64(Param: String): String; begin
194-
Result := GlobalErlangData.Name64; end;
195-
function ConstGetErlangExe32(Param: String): String; begin
196-
Result := GlobalErlangData.Exe32; end;
197-
function ConstGetErlangExe64(Param: String): String; begin
198-
Result := GlobalErlangData.Exe64; end;
199-
function ConstGetLatestErlangPath(Param: String): String; begin
200-
Result := GetLatestErlangPath; end;
201-
function ConstGetSelectedReleaseVersion(Param: String): String; begin
202-
Result := CacheSelectedRelease.Version; end;
194+
195+
{#StrInspectFuncDef('GlobalErlangData.Name32')}
196+
{#StrInspectFuncDef('GlobalErlangData.Name64')}
197+
{#StrInspectFuncDef('GlobalErlangData.Exe32')}
198+
{#StrInspectFuncDef('GlobalErlangData.Exe64')}
199+
{#StrInspectFuncDef('GetLatestErlangPath')}
200+
{#StrInspectFuncDef('CacheSelectedRelease.Version')}

0 commit comments

Comments
 (0)