aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_util.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2013-09-09 20:16:55 -0500
committerTristan Sloughter <[email protected]>2013-09-11 20:07:33 -0500
commitff0a11dc7b2e2ef902c97a62595b29e9bc89029a (patch)
treea96c523adba91117ee3ce4cfa557155c0cc303db /src/rlx_util.erl
parent2f54b2d5360c52fff2c3f8fde73b29b6069174ea (diff)
downloadrelx-ff0a11dc7b2e2ef902c97a62595b29e9bc89029a.tar.gz
relx-ff0a11dc7b2e2ef902c97a62595b29e9bc89029a.tar.bz2
relx-ff0a11dc7b2e2ef902c97a62595b29e9bc89029a.zip
allow multiple actions, including new action tar
Diffstat (limited to 'src/rlx_util.erl')
-rw-r--r--src/rlx_util.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/rlx_util.erl b/src/rlx_util.erl
index ac6af5c..c821896 100644
--- a/src/rlx_util.erl
+++ b/src/rlx_util.erl
@@ -21,7 +21,8 @@
%%% @doc Trivial utility file to help handle common tasks
-module(rlx_util).
--export([mkdir_p/1,
+-export([delete_dir/1,
+ mkdir_p/1,
to_binary/1,
to_string/1,
to_atom/1,
@@ -39,6 +40,19 @@
%%============================================================================
%% API
%%============================================================================
+%% @doc Deletes non-empty directory
+delete_dir(Path) ->
+ lists:foldr(fun(File, ok) ->
+ case filelib:is_dir(File) of
+ true ->
+ file:del_dir(File);
+ false ->
+ file:delete(File)
+ end
+ end, ok, filelib:wildcard(filename:join(Path, "**"))),
+ ok = file:del_dir(Path).
+
+
%% @doc Makes a directory including parent dirs if they are missing.
-spec mkdir_p(string()) -> ok | {error, Reason::file:posix()}.
mkdir_p(Path) ->