aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Merritt <[email protected]>2013-09-13 15:01:51 -0700
committerEric Merritt <[email protected]>2013-09-13 15:01:51 -0700
commit9a863c5924d787c5ce368fa9e98037714ba054d3 (patch)
tree5ac94bf5ec27708c85db84a96ad95e3847f52c3c
parent2da2a7fe52993d572a66ae4bd69f32ef1912b1ec (diff)
parent01504d1fb05430bc0fe5f2b30ebd57747a080d84 (diff)
downloadrelx-9a863c5924d787c5ce368fa9e98037714ba054d3.tar.gz
relx-9a863c5924d787c5ce368fa9e98037714ba054d3.tar.bz2
relx-9a863c5924d787c5ce368fa9e98037714ba054d3.zip
Merge pull request #36 from tsloughter/masterv0.1.20.1.2
replace use of wildcard ** since it is not in <R16 Erlang
-rw-r--r--src/rlx_prv_assembler.erl6
-rw-r--r--src/rlx_util.erl16
2 files changed, 4 insertions, 18 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index e0ddb01..1ef0840 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -451,12 +451,12 @@ make_tar(State, Release, OutputDir) ->
{erts, ErtsDir},
{outdir, OutputDir}]) of
ok ->
- TempDir = filename:join(OutputDir, integer_to_list(erlang:phash2(make_ref()))),
+ TempDir = ec_file:insecure_mkdtemp(),
try
update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion)
catch
E:R ->
- file:del_dir(TempDir),
+ ec_file:remove(TempDir, [recursive]),
?RLX_ERROR({tar_generation_error, E, R})
end;
{ok, Module, Warnings} ->
@@ -484,7 +484,7 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) ->
{"bin", filename:join([OutputDir, "bin"])}], [compressed]),
rlx_log:info(rlx_state:log(State),
"tarball ~s successfully created!~n", [TarFile]),
- rlx_util:delete_dir(TempDir),
+ ec_file:remove(TempDir, [recursive]),
{ok, State}.
make_upfrom_script(State, Release, UpFrom) ->
diff --git a/src/rlx_util.erl b/src/rlx_util.erl
index c821896..ac6af5c 100644
--- a/src/rlx_util.erl
+++ b/src/rlx_util.erl
@@ -21,8 +21,7 @@
%%% @doc Trivial utility file to help handle common tasks
-module(rlx_util).
--export([delete_dir/1,
- mkdir_p/1,
+-export([mkdir_p/1,
to_binary/1,
to_string/1,
to_atom/1,
@@ -40,19 +39,6 @@
%%============================================================================
%% 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) ->