Skip to content

Commit

Permalink
Merge pull request #57 from pickme467/guess_source
Browse files Browse the repository at this point in the history
Optimized guessing the source file for folder trees
  • Loading branch information
massemanet committed May 25, 2016
2 parents b0bd2ad + 602ceca commit 0ca3d73
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/distel.erl
Expand Up @@ -179,17 +179,14 @@ find_source(Mod) ->
{error, fmt("Can't find module '~p' on ~p", [Mod, node()])}
end.

%% Ret: AbsName | throw(Reason)
%% Ret: AbsName | throw(Reason)
guess_source_file(Mod, BeamFName) ->
Erl = to_list(Mod) ++ ".erl",
Dir = dirname(BeamFName),
DotDot = dirname(Dir),
try_srcs([src_from_beam(Mod),
join([Dir, Erl]),
join([DotDot, "src", Erl]),
join([DotDot, "src", "*", Erl]),
join([DotDot, "esrc", Erl]),
join([DotDot, "erl", Erl])]).
filelib:wildcard(join([DotDot, "**", Erl]))]).

try_srcs([]) -> throw(nothing);
try_srcs(["" | T]) -> try_srcs(T);
Expand Down

0 comments on commit 0ca3d73

Please sign in to comment.