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

Commit 9aa2afb

Browse files
committed
Split Erlang Path task into new and existing types
1 parent 63e535b commit 9aa2afb

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

ElixirWeb.iss

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ Filename: "{tmp}\Output\elixir-v{code:ConstGetSelectedReleaseVersion}-setup.exe"
6767
Name: "erlang"; Description: "Install Erlang"; GroupDescription: "Erlang"; Check: CheckToInstallErlang
6868
Name: "erlang\32"; Description: "{code:ConstGetErlangName32}"; GroupDescription: "Erlang"; Flags: exclusive
6969
Name: "erlang\64"; Description: "{code:ConstGetErlangName64}"; GroupDescription: "Erlang"; Flags: exclusive; Check: IsWin64
70-
Name: "erlpath"; Description: "Append Erlang directory to Path environment variable"; GroupDescription: "Erlang"; Check: CheckToAddErlangPath
70+
Name: "erlang\newpath"; Description: "Append Erlang directory to Path environment variable"; GroupDescription: "Erlang"
71+
Name: "existingpath"; Description: "Append {code:ConstGetExistingErlangPath}\bin to Path environment variable"; GroupDescription: "Erlang"; Check: CheckToAddErlangPath
7172

7273
[Code]
7374
#include "src\util.iss"
@@ -88,9 +89,18 @@ var
8889
8990
CacheSelectedRelease: TElixirRelease;
9091
92+
function GetExistingErlangPath(PrefVersion: String): String;
93+
begin
94+
Result := '';
95+
if IsWin64 then
96+
Result := GetErlangPath(True, PrefVersion);
97+
if Result = '' then
98+
Result := GetErlangPath(False, PrefVersion);
99+
end;
100+
91101
procedure AppendErlangPathIfTaskSelected(Of64Bit: Boolean);
92102
begin
93-
if IsTaskSelected('erlpath') then
103+
if IsTaskSelected('erlang\newpath') or IsTaskSelected('existingpath') then
94104
AppendErlangPath(Of64Bit, GlobalErlangData.ERTSVersion);
95105
end;
96106
@@ -179,16 +189,19 @@ begin
179189
end;
180190
181191
function CheckToInstallErlang: Boolean; begin
182-
Result := (not ErlangInPath) and
183-
(
184-
(GetErlangPath(False, GlobalErlangData.ERTSVersion) = '') or
185-
(GetErlangPath(True, GlobalErlangData.ERTSVersion) = '' )
186-
); end;
192+
Result := (not ErlangInPath) and (GetExistingErlangPath(GlobalErlangData.ERTSVersion) = ''); end;
187193
function CheckToAddErlangPath: Boolean; begin
188194
Result := not ErlangInPath; end;
189195
190-
function ConstGetErlangName32(Param: String): String; begin Result := GlobalErlangData.Name32; end;
191-
function ConstGetErlangName64(Param: String): String; begin Result := GlobalErlangData.Name64; end;
192-
function ConstGetErlangExe32(Param: String): String; begin Result := GlobalErlangData.Exe32; end;
193-
function ConstGetErlangExe64(Param: String): String; begin Result := GlobalErlangData.Exe64; end;
194-
function ConstGetSelectedReleaseVersion(Param: String): String; begin Result := CacheSelectedRelease.Version; end;
196+
function ConstGetErlangName32(Param: String): String; begin
197+
Result := GlobalErlangData.Name32; end;
198+
function ConstGetErlangName64(Param: String): String; begin
199+
Result := GlobalErlangData.Name64; end;
200+
function ConstGetErlangExe32(Param: String): String; begin
201+
Result := GlobalErlangData.Exe32; end;
202+
function ConstGetErlangExe64(Param: String): String; begin
203+
Result := GlobalErlangData.Exe64; end;
204+
function ConstGetExistingErlangPath(Param: String): String; begin
205+
Result := GetExistingErlangPath(GlobalErlangData.ERTSVersion); end;
206+
function ConstGetSelectedReleaseVersion(Param: String): String; begin
207+
Result := CacheSelectedRelease.Version; end;

0 commit comments

Comments
 (0)