mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
add chmod template directive for changing file file permission
usage: {chmod, Mode, File} where: Mode is an integer, as specified by the 'mode' field of the file_info record (see docs for file:write_file_info/2)
This commit is contained in:
parent
4c2dade0f4
commit
60629e8516
1 changed files with 8 additions and 0 deletions
|
@ -254,6 +254,14 @@ execute_template([{dir, Name} | Rest], TemplateType, TemplateName, Context, Forc
|
|||
?ABORT("Failed while processing template instruction {dir, ~s}: ~p\n",
|
||||
[Name, Reason])
|
||||
end;
|
||||
execute_template([{chmod, Mod, File} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) when is_integer(Mod) ->
|
||||
case file:change_mode(File, Mod) of
|
||||
ok ->
|
||||
execute_template(Rest, TemplateType, TemplateName, Context, Force, ExistingFiles);
|
||||
{error, Reason} ->
|
||||
?ABORT("Failed while processing template instruction {cmod, ~b, ~s}: ~p~n",
|
||||
[Mod, File, Reason])
|
||||
end;
|
||||
execute_template([{variables, _} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) ->
|
||||
execute_template(Rest, TemplateType, TemplateName, Context, Force, ExistingFiles);
|
||||
execute_template([{file, Input, Output} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) ->
|
||||
|
|
Loading…
Reference in a new issue