From eb23571b8b217ff562b3f4e5d6bfd154532ebb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20D=C4=85bek?= Date: Thu, 29 Sep 2011 00:23:08 +0200 Subject: Add possibility to make symbolic links Simple feature, useful to make link to something without copying it. --- src/rebar_templater.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index 5fe427b..d5709c3 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -380,6 +380,16 @@ execute_template([{chmod, Mod, File} | Rest], TemplateType, TemplateName, ?ABORT("Failed while processing template instruction " "{cmod, ~b, ~s}: ~p~n", [Mod, File, Reason]) end; +execute_template([{symlink, Target, LinkName} | Rest], TemplateType, TemplateName, + Context, Force, ExistingFiles) -> + case file:make_symlink(Target, LinkName) of + ok -> + execute_template(Rest, TemplateType, TemplateName, + Context, Force, ExistingFiles); + {error, Reason} -> + ?ABORT("Failed while processing template instruction " + "{symlink, ~s, ~s}: ~p~n", [Target, LinkName, Reason]) + end; execute_template([{variables, _} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) -> execute_template(Rest, TemplateType, TemplateName, -- cgit v1.1