From 16218713878c747b91c2d7d72df8648e61dbd63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 4 May 2013 01:02:21 +0200 Subject: [PATCH] Simpify rm_r --- test/repo_test.erl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/repo_test.erl b/test/repo_test.erl index ab33e3e..391987e 100644 --- a/test/repo_test.erl +++ b/test/repo_test.erl @@ -48,18 +48,14 @@ create_ref_test(Repo) -> rm_r(Path) -> case filelib:is_dir(Path) of false -> - ok = file:delete(Path); + file:delete(Path); true -> - case file:list_dir(Path) of - {ok, []} -> - ok = file:del_dir(Path); - {ok, Filenames} -> - lists:foreach(fun(X) -> rm_r(filename:join([Path, X])) end, Filenames), - file:del_dir(Path) - end + {ok, Entries} = file:list_dir(Path), + lists:foreach(fun(X) -> ok = rm_r(filename:join([Path, X])) end, Entries), + file:del_dir(Path) end. stop(Repo) -> Path = geef_repo:path(Repo), geef_repo:stop(Repo), - rm_r(Path). + ok = rm_r(Path).