From 8ce1de1825964d20bf576d19929615542efda1ff Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Tue, 3 Mar 2015 08:03:22 -0600 Subject: use rebar_file_utils:mv instead of copy for fetched source --- src/rebar_fetch.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_fetch.erl b/src/rebar_fetch.erl index 9c427df..b2ad211 100644 --- a/src/rebar_fetch.erl +++ b/src/rebar_fetch.erl @@ -38,7 +38,8 @@ download_source(AppDir, Source, State) -> ec_file:mkdir_p(AppDir1), code:del_path(filename:absname(filename:join(AppDir1, "ebin"))), ec_file:remove(filename:absname(AppDir1), [recursive]), - ok = ec_file:copy(TmpDir, filename:absname(AppDir1), [recursive]), + ?DEBUG("Moving checkout ~p to ~p", [TmpDir, filename:absname(AppDir1)]), + ok = rebar_file_utils:mv(TmpDir, filename:absname(AppDir1)), true; {tarball, File} -> Contents = filename:join(TmpDir, "contents"), @@ -49,7 +50,12 @@ download_source(AppDir, Source, State) -> [{cwd, Contents}, compressed]), code:del_path(filename:absname(filename:join(AppDir1, "ebin"))), ec_file:remove(filename:absname(AppDir1), [recursive]), - ok = ec_file:copy(Contents, filename:absname(AppDir1), [recursive]), + + ?DEBUG("Moving contents ~p to ~p", [Contents, filename:absname(AppDir1)]), + ok = rebar_file_utils:mv(Contents, filename:absname(AppDir1)), + + ?DEBUG("Removing tmp dir ~p", [TmpDir]), + ec_file:remove(TmpDir, [recursive]), true end catch -- cgit v1.1