diff options
-rw-r--r-- | src/rebar_prv_compile.erl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index 0c6f40b..3d952ab 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -71,7 +71,7 @@ build_app(State, AppInfo) -> AppDir = rebar_app_info:dir(AppInfo), OutDir = rebar_app_info:out_dir(AppInfo), - copy_app_dirs(rebar_app_info:name(AppInfo), AppDir, OutDir), + copy_app_dirs(AppDir, OutDir), S = case rebar_app_info:state(AppInfo) of undefined -> @@ -108,16 +108,17 @@ handle_args(State) -> Jobs = proplists:get_value(jobs, Args, ?DEFAULT_JOBS), {ok, rebar_state:set(State, jobs, Jobs)}. -copy_app_dirs(AppName, OldAppDir, AppDir) -> +copy_app_dirs(OldAppDir, AppDir) -> case ec_cnv:to_binary(filename:absname(OldAppDir)) =/= ec_cnv:to_binary(filename:absname(AppDir)) of true -> - Name = ec_cnv:to_list(AppName), - AppFile = filename:join([OldAppDir, "ebin", Name++".app"]), - case filelib:is_file(AppFile) of + EbinDir = filename:join([OldAppDir, "ebin"]), + %% copy all files from ebin if it exists + case filelib:is_dir(EbinDir) of true -> - file:copy(AppFile, - filename:join([AppDir, "ebin", Name++".app"])); + OutEbin = filename:join(AppDir, "ebin"), + filelib:ensure_dir(filename:join(OutEbin, "dummy.beam")), + rebar_file_utils:cp_r(filelib:wildcard(filename:join(EbinDir, "*")), OutEbin); false -> ok end, |