[erlang-questions] Configuring rebar across directories

Tuncer Ayaz <>
Tue Jun 18 17:41:22 CEST 2013


On Tue, Jun 18, 2013 at 5:02 PM, Juan Jose Comellas wrote:
> Tuncer, is there a reason why the rebar lib_dirs configuration
> setting only allows relative paths? Right now the function that
> expands these paths looks like this:

I'm not aware of any reason and I think you're the first to request
support for absolute paths.

>     expand_lib_dirs([], _Root, Acc) ->
>         Acc;
>     expand_lib_dirs([Dir | Rest], Root, Acc) ->
>         Apps = filelib:wildcard(filename:join([Dir, "*", "ebin"])),
>         FqApps = [filename:join([Root, A]) || A <- Apps],
>         expand_lib_dirs(Rest, Root, Acc ++ FqApps).
>
> Changing it to something like this would resolve this problem:
>
>     expand_lib_dirs([], _Root, Acc) ->
>         Acc;
>     expand_lib_dirs([Dir | Rest], Root, Acc) ->
>         Apps = filelib:wildcard(filename:join([Dir, "*", "ebin"])),
>         FqApps = case filename:pathtype(Dir) of
>                      absolute -> Apps;
>                      relative -> [filename:join([Root, A]) || A <- Apps]
>                  end,
>         expand_lib_dirs(Rest, Root, Acc ++ FqApps).
>
> Would this addition be accepted into rebar? I haven't created a pull
> request for this because I don't know what the rationale was for
> making these paths relative.

This looks reasonable to me, but I can't speak for Dave.



More information about the erlang-questions mailing list