Macro may require to safely join the paths to generate shell commands or others, when the path may be determined by variables. Like this:
macro mark_down(what)
{{ run("cat res/#{what}.md").stringify }} # not cross-platform safe!
# cross-platform safe:
{{ run("cat " + join_path("res", "#{what}.md")).stringify }}
end
puts mark_down book
Just do:
{% if flag?(:windows) %}
...
{% else %}
{% end %}
because I think you will have problems with cat working on Windows to start with...
Once there was #2791, which would solve this issue.
Okay, but the case of executing a program locates in a specific path? In this case, path join may be required.
@asterite that doesn't work when cross-compiling, since the macros are executed on the host triple and the flags are for the target triple.
Well, nobody liked my idea of the read_file macro method. If you want it now, go for it :-)
Most helpful comment
Well, nobody liked my idea of the
read_filemacro method. If you want it now, go for it :-)