summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2010-01-04 06:17:35 -0700
committerDave Smith <dizzyd@dizzyd.com>2010-01-04 06:17:35 -0700
commit21f60bff748b7679e107d2afd6d9d3da8e890972 (patch)
tree2308748441810c6271c2ed846d9fb78fa5436062 /src
parent51f6906da9f765a116c261b63becd1c2e758ae80 (diff)
Take 323 on cleaning package dirs from ebin
Diffstat (limited to 'src')
-rw-r--r--src/rebar_erlc_compiler.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index 80adc4e..575e7dc 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -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)).