From 1acc5db0b50e66fdc72a1fbcf3ea7c3f2bc239c8 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Fri, 26 Oct 2018 23:01:49 +0200 Subject: Make reltool correctly handle Windows 'ERL_LIBS' Without this patch reltool would try to split strings like "C:\foo" into ["C","\foo"]. --- lib/reltool/src/reltool_utils.erl | 13 ++++++++++++- lib/reltool/test/reltool_server_SUITE.erl | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'lib/reltool') diff --git a/lib/reltool/src/reltool_utils.erl b/lib/reltool/src/reltool_utils.erl index 060a0912f9..2afa386cb3 100644 --- a/lib/reltool/src/reltool_utils.erl +++ b/lib/reltool/src/reltool_utils.erl @@ -47,6 +47,9 @@ call/2, cast/2, reply/3]). +%% For testing +-export([erl_libs/2]). + -include_lib("kernel/include/file.hrl"). -include_lib("wx/include/wx.hrl"). -include("reltool.hrl"). @@ -55,7 +58,15 @@ root_dir() -> code:root_dir(). erl_libs() -> - string:lexemes(os:getenv("ERL_LIBS", ""), ":;"). + erl_libs(os:getenv("ERL_LIBS", ""), os:type()). + +erl_libs(ErlLibs, OsType) when is_list(ErlLibs) -> + Sep = + case OsType of + {win32, _} -> ";"; + _ -> ":" + end, + string:lexemes(ErlLibs, Sep). lib_dirs(Dir) -> case erl_prim_loader:list_dir(Dir) of diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index 4e1937d479..e7a9c82777 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -142,7 +142,8 @@ all() -> use_selected_vsn, use_selected_vsn_relative_path, non_standard_vsn_id, - undefined_regexp]. + undefined_regexp, + windows_erl_libs]. groups() -> []. @@ -2545,11 +2546,22 @@ undefined_regexp(_Config) -> {add, ["^priv"]}}]}]}])), ok. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Checks that reltool_utils can correctly read Windows ERL_LIBS + +windows_erl_libs(_Config) -> + WinErlLibs = + "C:\Program Files\Erlang Libs;C:\Program Files\More Erlang Libs", + Ret = reltool_utils:erl_libs(WinErlLibs, {win32, nt}), + ?m(["C:\Program Files\Erlang Libs","C:\Program Files\More Erlang Libs"], + Ret), + ok. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Library functions erl_libs() -> - string:lexemes(os:getenv("ERL_LIBS", ""), ":;"). + reltool_utils:erl_libs(). datadir(Config) -> %% Removes the trailing slash... -- cgit v1.2.3 From 807c48ea7999a9ed7becdd31db0a8e8e647d5bd2 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Mon, 29 Oct 2018 13:01:04 +0100 Subject: Fix windows backslashes in test --- lib/reltool/test/reltool_server_SUITE.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/reltool') diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index e7a9c82777..9ee61b595d 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -2551,9 +2551,9 @@ undefined_regexp(_Config) -> windows_erl_libs(_Config) -> WinErlLibs = - "C:\Program Files\Erlang Libs;C:\Program Files\More Erlang Libs", + "C:\\Program Files\\Erlang Libs;C:\\Program Files\\More Erlang Libs", Ret = reltool_utils:erl_libs(WinErlLibs, {win32, nt}), - ?m(["C:\Program Files\Erlang Libs","C:\Program Files\More Erlang Libs"], + ?m(["C:\\Program Files\\Erlang Libs","C:\\Program Files\\More Erlang Libs"], Ret), ok. -- cgit v1.2.3