diff options
-rw-r--r-- | src/rlx_prv_overlay.erl | 2 | ||||
-rw-r--r-- | test/rlx_release_SUITE.erl | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl index 2a81730..f242d21 100644 --- a/src/rlx_prv_overlay.erl +++ b/src/rlx_prv_overlay.erl @@ -314,7 +314,7 @@ copy_to(State, FromFile0, ToFile0) -> erlang:iolist_to_binary(filename:join(ToFile1, filename:basename(FromFile1))) end, - case ec_file:copy(FromFile1, ToFile2) of + case ec_file:copy(FromFile1, ToFile2, [recursive]) of ok -> {ok, FileInfo} = file:read_file_info(FromFile1), ok = file:write_file_info(ToFile2, FileInfo), diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl index ccf5a8f..aea28f2 100644 --- a/test/rlx_release_SUITE.erl +++ b/test/rlx_release_SUITE.erl @@ -383,6 +383,11 @@ overlay_release(Config) -> ConfigFile = filename:join([LibDir1, "relx.config"]), OverlayVars = filename:join([LibDir1, "vars.config"]), Template = filename:join([LibDir1, "test_template"]), + TestDir = "first_test_dir", + TestFile = "test_file", + TestDirFull = filename:join([LibDir1, TestDir]), + TestFileFull = filename:join(TestDirFull, TestFile), + SecondTestDir = "second_test_dir", write_config(ConfigFile, [{overlay_vars, OverlayVars}, {overlay, [{mkdir, "{{target_dir}}/fooo"}, @@ -390,6 +395,8 @@ overlay_release(Config) -> "{{target_dir}}/{{foo_dir}}/vars.config"}, {copy, OverlayVars, "{{target_dir}}/{{yahoo}}/"}, + {copy, TestDirFull, + "{{target_dir}}/"++SecondTestDir++"/"}, {template, Template, "{{target_dir}}/test_template_resolved"}]}, {release, {foo, "0.0.1"}, @@ -402,6 +409,9 @@ overlay_release(Config) -> {yahoo3, [{bar, "{{yahoo}}/{{yahoo2.foo}}"}]}, {foo_dir, "foodir"}]), + ok = rlx_util:mkdir_p(TestDirFull), + ok = file:write_file(TestFileFull, test_template_contents()), + TemplateFile = filename:join([LibDir1, "test_template"]), ok = file:write_file(TemplateFile, test_template_contents()), {ok, FileInfo} = file:read_file_info(TemplateFile), @@ -426,6 +436,8 @@ overlay_release(Config) -> ?assert(ec_file:exists(filename:join(OutputDir, "fooo"))), ?assert(ec_file:exists(filename:join([OutputDir, "foodir", "vars.config"]))), ?assert(ec_file:exists(filename:join([OutputDir, "yahoo", "vars.config"]))), + io:format("DirFile ~p~n", [filename:join([OutputDir, SecondTestDir, TestDir, TestFile])]), + ?assert(ec_file:exists(filename:join([OutputDir, SecondTestDir, TestDir, TestFile]))), TemplateData = case file:consult(filename:join([OutputDir, "test_template_resolved"])) of {ok, Details} -> |