Closed aeldemery closed 3 years ago
Using $
in folder names is a bit iffy, especially on Unix-like operating systems.
But I have tested it $
and it's an acceptable char in folder names.
Actually I just remembered I should refactor the code to allow also files not only folders. So probably I would visit the code again as soon as I get some time.
according to various internet sources both the characters $
and {
/}
are allowed inside path and filenames in windows and linux.
Moreover it's been used with other templating engines like jinja2 and tera.
My goal was to produce files like this for example:
com.example.proj-name.icon
com.example.proj-name.desktop.in
If you have a veto against using templating in files/folder-names to keep valdo
simple, please let me know so I would abort my efforts.
I would also suggest to change templated files extension form in
to something else to avoid conflicts with meson
, for example .template
or .tmpl
.
@aeldemery I take your point. My initial concern was the potential for uniquely bad consequences if a future bug results in file operations being attempted on folders that evaluate to /
. It also makes it tricky to manipulate the folders with command line tools.
I think the motivation is good. Perhaps we could instead have, in the template file, a list of renamings to perform?
Perhaps if you could explain further an example of how dollar signs are used in Tera or other templating engines, I would change my mind.
Thank you for your review.
For some of the code generating tools on github which use jinja2 and tera are coockiecutter and kickstart respectively.
you are right, one should build paths using specified API rather than concatenating strings. I will update the MR. Thanks
sbt new (via g8) supports it http://www.foundweekends.org/giter8/template.html
So I'm inclined to support this PR after thinking it over. I still need you to make the changes I suggested.
Sorry for late answer. I pushed the required suggestions. I wanted to do some restructuring to the template code so the substitution works correctly if folders not empty.
@Prince781 sorry I've been busy lately. You can pick up with this PR and modify it at will or close it applying your own logic to obtain the same end result. Thank you.
Unfortunately I can't push directly to your branch so I've made a new branch with some modifications.
Closing this in favor of #8
with this PR, one would be able to use variables inside project directory structures.