Skip to content

Commit

Permalink
Merge pull request #36 from tsloughter/master
Browse files Browse the repository at this point in the history
replace use of wildcard ** since it is not in <R16 Erlang
  • Loading branch information
ericbmerritt committed Sep 13, 2013
2 parents 2da2a7f + 01504d1 commit 9a863c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/rlx_prv_assembler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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} ->
Expand Down Expand Up @@ -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) ->
Expand Down
16 changes: 1 addition & 15 deletions src/rlx_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) ->
Expand Down

0 comments on commit 9a863c5

Please sign in to comment.