From 1549b11b88dca340a1e471775d8387ca94e377e5 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Fri, 26 Sep 2014 19:51:45 -0500 Subject: getting closer --- src/rebar_fetch.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/rebar_fetch.erl') diff --git a/src/rebar_fetch.erl b/src/rebar_fetch.erl index 6b31f6c..0a90848 100644 --- a/src/rebar_fetch.erl +++ b/src/rebar_fetch.erl @@ -49,14 +49,16 @@ lock_source(_AppDir, Source) -> download_source(AppDir, Source) -> TmpDir = ec_file:insecure_mkdtemp(), AppDir1 = ec_cnv:to_list(AppDir), + ec_file:mkdir_p(AppDir1), case download_source_tmp(TmpDir, Source) of {ok, _} -> - ec_file:mkdir_p(AppDir1), ok = ec_file:copy(TmpDir, filename:absname(AppDir1), [recursive]); {tarball, File} -> - ok = erl_tar:extract(File, [{cwd, - (filename:dirname(filename:absname(AppDir1)))} - ,compressed]) + ok = erl_tar:extract(File, [{cwd, TmpDir} + ,compressed]), + BaseName = filename:basename(AppDir1), + [FromDir] = filelib:wildcard(filename:join(TmpDir, BaseName++"-*")), + ec_file:copy(FromDir, AppDir1, [recursive]) end. download_source_tmp(TmpDir, {p4, Url}) -> -- cgit v1.1