Simpify rm_r
This commit is contained in:
@@ -48,18 +48,14 @@ create_ref_test(Repo) ->
|
|||||||
rm_r(Path) ->
|
rm_r(Path) ->
|
||||||
case filelib:is_dir(Path) of
|
case filelib:is_dir(Path) of
|
||||||
false ->
|
false ->
|
||||||
ok = file:delete(Path);
|
file:delete(Path);
|
||||||
true ->
|
true ->
|
||||||
case file:list_dir(Path) of
|
{ok, Entries} = file:list_dir(Path),
|
||||||
{ok, []} ->
|
lists:foreach(fun(X) -> ok = rm_r(filename:join([Path, X])) end, Entries),
|
||||||
ok = file:del_dir(Path);
|
|
||||||
{ok, Filenames} ->
|
|
||||||
lists:foreach(fun(X) -> rm_r(filename:join([Path, X])) end, Filenames),
|
|
||||||
file:del_dir(Path)
|
file:del_dir(Path)
|
||||||
end
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
stop(Repo) ->
|
stop(Repo) ->
|
||||||
Path = geef_repo:path(Repo),
|
Path = geef_repo:path(Repo),
|
||||||
geef_repo:stop(Repo),
|
geef_repo:stop(Repo),
|
||||||
rm_r(Path).
|
ok = rm_r(Path).
|
||||||
|
|||||||
Reference in New Issue
Block a user