mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Take 323 on cleaning package dirs from ebin
This commit is contained in:
parent
51f6906da9
commit
21f60bff74
1 changed files with 12 additions and 4 deletions
|
@ -53,10 +53,14 @@ clean(_Config, _AppFile) ->
|
|||
%% directory structure in ebin with .beam files within. As such, we want
|
||||
%% to scan whatever is left in the ebin/ directory for sub-dirs which
|
||||
%% satisfy our criteria. TODO: Is there a better way to do this?
|
||||
BeamFiles = filelib:fold_files("ebin", "^.*\\.beam\$", true,
|
||||
fun(F, BeamFiles) -> BeamFiles ++ [F] end, []),
|
||||
rebar_file_utils:delete_each(BeamFiles),
|
||||
ok.
|
||||
Dirs = ordsets:from_list([base_dir(F) ||
|
||||
F <- rebar_utils:find_files("ebin", "^.*\\.beam\$")]),
|
||||
case Dirs of
|
||||
[] ->
|
||||
ok;
|
||||
_ ->
|
||||
ok = rebar_file_utils:rm_rf(string:join(Dirs, " "))
|
||||
end.
|
||||
|
||||
|
||||
|
||||
|
@ -159,3 +163,7 @@ compile_mib(Source, _Target, Config) ->
|
|||
{error, compilation_failed} ->
|
||||
?FAIL
|
||||
end.
|
||||
|
||||
base_dir(Filename) ->
|
||||
["ebin" | Rest] = filename:split(Filename),
|
||||
filename:join("ebin", hd(Rest)).
|
||||
|
|
Loading…
Reference in a new issue