Give an absolute path to code:add_path/1

If an app uses -include_lib for its own included files, compilation
fails if the app directory isn't in $ERL_LIBS because code:lib_dir/1
will return an error. An absolute path needs to be added to code path
instead of just "ebin".
This commit is contained in:
Anthony Ramine 2011-02-15 01:51:35 +01:00 committed by Tuncer Ayaz
parent 1b10807193
commit 9ee8ed9181

View file

@ -152,7 +152,7 @@ doterl_compile(Config, OutDir, MoreSources) ->
%% Make sure that ebin/ exists and is on the path %% Make sure that ebin/ exists and is on the path
ok = filelib:ensure_dir(filename:join("ebin", "dummy.beam")), ok = filelib:ensure_dir(filename:join("ebin", "dummy.beam")),
CurrPath = code:get_path(), CurrPath = code:get_path(),
true = code:add_path("ebin"), true = code:add_path(filename:absname("ebin")),
rebar_base_compiler:run(Config, NewFirstErls, OtherErls, rebar_base_compiler:run(Config, NewFirstErls, OtherErls,
fun(S, C) -> fun(S, C) ->
internal_erl_compile(S, C, OutDir, ErlOpts) internal_erl_compile(S, C, OutDir, ErlOpts)