aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_overlay.erl
diff options
context:
space:
mode:
authorLuis Rascão <[email protected]>2016-10-27 19:07:16 +0100
committerGitHub <[email protected]>2016-10-27 19:07:16 +0100
commit3ecc5c8a054fb4bf5515848d572b201fc2f5d13a (patch)
tree9c418e34ca331ca3ab63eaa723e7406ba77a5515 /src/rlx_prv_overlay.erl
parent42dcb2a4c2ca74eec5c756767d53317ad8e0c227 (diff)
parentf0e0d1acc7e4b645e9dac38e8323bbc1cb8fb03c (diff)
downloadrelx-3ecc5c8a054fb4bf5515848d572b201fc2f5d13a.tar.gz
relx-3ecc5c8a054fb4bf5515848d572b201fc2f5d13a.tar.bz2
relx-3ecc5c8a054fb4bf5515848d572b201fc2f5d13a.zip
Merge pull request #527 from lrascao/feature/replace_os_vars_test
Feature/replace os vars test
Diffstat (limited to 'src/rlx_prv_overlay.erl')
-rw-r--r--src/rlx_prv_overlay.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index 71aca97..a4c0fa4 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -461,6 +461,14 @@ write_template(OverlayVars, FromFile, ToFile) ->
{ok, IoData} ->
case filelib:ensure_dir(ToFile) of
ok ->
+ %% we were asked to render a template
+ %% onto a symlink, this would cause an overwrite
+ %% of the original file, so we delete the symlink
+ %% and go ahead with the template render
+ case ec_file:is_symlink(ToFile) of
+ true -> ec_file:remove(ToFile);
+ false -> ok
+ end,
case file:write_file(ToFile, IoData) of
ok ->
{ok, FileInfo} = file:read_file_info(FromFile),