aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_prv_overlay.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2012-12-30 16:59:44 -0500
committerEric <[email protected]>2012-12-30 16:59:44 -0500
commit8cbfdd28679872a1791fee615585aec6c03dd5f9 (patch)
treeb9e018fd4591365c0edc232125969f04fcf8ceb7 /src/rcl_prv_overlay.erl
parent3e295e146c960252af0008f1f13a7e40bcbdb929 (diff)
downloadrelx-8cbfdd28679872a1791fee615585aec6c03dd5f9.tar.gz
relx-8cbfdd28679872a1791fee615585aec6c03dd5f9.tar.bz2
relx-8cbfdd28679872a1791fee615585aec6c03dd5f9.zip
support 'to' dirs for mkdirs, templates, and copies being based on output dir
Diffstat (limited to 'src/rcl_prv_overlay.erl')
-rw-r--r--src/rcl_prv_overlay.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rcl_prv_overlay.erl b/src/rcl_prv_overlay.erl
index b854650..0e9781b 100644
--- a/src/rcl_prv_overlay.erl
+++ b/src/rcl_prv_overlay.erl
@@ -249,7 +249,9 @@ do_individual_overlay(State, OverlayVars, {mkdir, Dir}) ->
{ok, ModuleName} ->
case render(ModuleName, OverlayVars) of
{ok, IoList} ->
- Absolute = absolutize(State, IoList),
+ Absolute = absolutize(State,
+ filename:join(rcl_state:output_dir(State),
+ erlang:iolist_to_binary(IoList))),
case rcl_util:mkdir_p(Absolute) of
{error, Error} ->
?RCL_ERROR({unable_to_make_dir, Absolute, Error});
@@ -279,15 +281,20 @@ do_individual_overlay(State, OverlayVars, {template, From, To}) ->
fun(FromFile) ->
file_render_do(OverlayVars, To, ToTemplateName,
fun(ToFile) ->
+ FromFile0 = absolutize(State,
+ filename:join(rcl_state:output_dir(State),
+ erlang:iolist_to_binary(FromFile))),
+ FromFile1 = erlang:binary_to_list(FromFile0),
write_template(OverlayVars,
- erlang:binary_to_list(absolutize(State, FromFile)),
+ FromFile1,
absolutize(State, ToFile))
end)
end).
-spec copy_to(rcl_state:t(), file:name(), file:name()) -> ok | relcool:error().
copy_to(State, FromFile0, ToFile0) ->
- ToFile1 = absolutize(State, ToFile0),
+ ToFile1 = absolutize(State, filename:join(rcl_state:output_dir(State),
+ erlang:iolist_to_binary(ToFile0))),
FromFile1 = absolutize(State, FromFile0),
ToFile2 = case is_directory(ToFile0, ToFile1) of
false ->