mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Adding delete_each/1
This commit is contained in:
parent
667dd16bf9
commit
b3909cc9dc
1 changed files with 15 additions and 1 deletions
|
@ -27,7 +27,8 @@
|
||||||
-export([rm_rf/1,
|
-export([rm_rf/1,
|
||||||
mkdir_p/1,
|
mkdir_p/1,
|
||||||
cp_r/2,
|
cp_r/2,
|
||||||
ln_sf/2]).
|
ln_sf/2,
|
||||||
|
delete_each/1]).
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
|
||||||
|
@ -57,4 +58,17 @@ ln_sf(Source, Dest) ->
|
||||||
end,
|
end,
|
||||||
[] = os:cmd(?FMT("ln -sf ~s ~s", [Source, Dest])),
|
[] = os:cmd(?FMT("ln -sf ~s ~s", [Source, Dest])),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
delete_each([]) ->
|
||||||
|
ok;
|
||||||
|
delete_each([File | Rest]) ->
|
||||||
|
case file:delete(File) of
|
||||||
|
ok ->
|
||||||
|
delete_each(Rest);
|
||||||
|
{error, enoent} ->
|
||||||
|
delete_each(Rest);
|
||||||
|
{error, Reason} ->
|
||||||
|
?ERROR("Failed to delete file ~s: ~p\n", [File, Reason]),
|
||||||
|
?FAIL
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue