diff options
author | Juan Jose Comellas <juanjo@comellas.org> | 2011-02-22 01:58:46 -0300 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-02-26 15:57:17 +0100 |
commit | 58661a92e205b44a5090f9a2c4371a94bab692ec (patch) | |
tree | eb33ccc6100abd474ecddfb1c6d7e6c434ecae35 /src/rebar_utils.erl | |
parent | 90d2ce5e0770be25179376af87ce861c33c1ba14 (diff) |
Convert the entries in the code path to absolute paths
Rebar will exit with {error,bad_directory} when trying to restore the code
path after it has finished working on a subdirectory if there are invalid
relative paths in it. The problem was seen when executing the last line of
rebar_erlc_compiler:doterl_compile/3 (true = code:set_path(CurrPath)).
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r-- | src/rebar_utils.erl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 2822c0f..8898b8a 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -38,7 +38,8 @@ abort/2, escript_foldl/3, find_executable/1, - prop_check/3]). + prop_check/3, + expand_code_path/0]). -include("rebar.hrl"). @@ -156,6 +157,14 @@ find_executable(Name) -> prop_check(true, _, _) -> true; prop_check(false, Msg, Args) -> ?ABORT(Msg, Args). +%% Convert all the entries in the code path to absolute paths. +expand_code_path() -> + CodePath = lists:foldl(fun (Path, Acc) -> + [filename:absname(Path) | Acc] + end, [], code:get_path()), + code:set_path(lists:reverse(CodePath)). + + %% ==================================================================== %% Internal functions %% ==================================================================== |