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,
|
||||
mkdir_p/1,
|
||||
cp_r/2,
|
||||
ln_sf/2]).
|
||||
ln_sf/2,
|
||||
delete_each/1]).
|
||||
|
||||
-include("rebar.hrl").
|
||||
|
||||
|
@ -58,3 +59,16 @@ ln_sf(Source, Dest) ->
|
|||
[] = os:cmd(?FMT("ln -sf ~s ~s", [Source, Dest])),
|
||||
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