rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

tar without erts and use on Windows, don't use the first erl path

Open ghost opened this issue 3 years ago • 2 comments

I install two erl version in my os erl8.3 in path but erl-23.0 not in(just because the old program use 8.3) so i add another with: $env:Path ="C:\Program Files\erl-23.0\bin;" + $env:Path

then tar without erts -> unpack xxx.tar.gz -> cd xxx -> bin/xxx.cmd console The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the file c:\Program Files\erl8.3\erts-11.0\bin\werl.exe.

so i check xxx.cmd and find this :set_erts_dir_from_erl for /f "delims=" %%i in ('where erl') do ( set "erl=%%i" )

then i try it in cmd

where erl C:\Program Files\erl-23.0\bin\erl.exe C:\Program Files\erl8.3\bin\erl.exe

erl -version Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 11.0

for /f "delims=" %i in ('where erl') do (set "erl=%%i")

(set "erl=%C:\Program Files\erl-23.0\bin\erl.exe" )

(set "erl=%C:\Program Files\erl8.3\bin\erl.exe" )

echo %erl% %C:\Program Files\erl8.3\bin\erl.exe

it use 8.3 instead of 23.0

ghost avatar Sep 09 '20 06:09 ghost

Ah yeah, the issue seems to just be that it when many exists it assigns the last one instead of the first one. I guess there'd be a need for a conditional where erl=... is only set if it has no value yet.

ferd avatar Sep 16 '20 15:09 ferd

Ah yeah, the issue seems to just be that it when many exists it assigns the last one instead of the first one. I guess there'd be a need for a conditional where erl=... is only set if it has no value yet.

emm, i add this code and it work(windows10)

for /f "delims=" %%i in ('where erl') do ( if not defined erl set "erl=%%i" )

D:\tmp>for /F "delims=" %i in ('where erl') do (if not defined erl set "erl=%i" )

D:\tmp>(if not defined erl set "erl=C:\Program Files\erl-23.0\bin\erl.exe" )

D:\tmp>(if not defined erl set "erl=C:\Program Files\erl8.3\bin\erl.exe" )

D:\tmp>echo C:\Program Files\erl-23.0\bin\erl.exe

maybe you can fix it with this^_^

ghost avatar Sep 19 '20 04:09 ghost