aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_util.erl
diff options
context:
space:
mode:
authorEric Merritt <[email protected]>2013-09-12 09:21:23 -0700
committerEric Merritt <[email protected]>2013-09-12 09:21:23 -0700
commit73536c5a81c5aff57c8e7f8d76fde760b5ddd3ce (patch)
treeb8ed308a349df7ca63870674de66b016bca9fea7 /src/rlx_util.erl
parent98c23703286175124c6e35445a88ca1381b2fb27 (diff)
parent8bc6e0acf352aa5fb0a8567f1f87d5fc6250ed15 (diff)
downloadrelx-73536c5a81c5aff57c8e7f8d76fde760b5ddd3ce.tar.gz
relx-73536c5a81c5aff57c8e7f8d76fde760b5ddd3ce.tar.bz2
relx-73536c5a81c5aff57c8e7f8d76fde760b5ddd3ce.zip
Merge pull request #29 from tsloughter/masterv0.1.00.1.0
Tar action, multiple actions on cli and rename release dir
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) ->