c++ - Get file directory in Apache Velocity Template Language -


clion uses apache's velocity template language (vtl) create templates c++ , c files. on clion's (https://www.jetbrains.com/help/clion/file-template-variables.html) bunch of variables can used listed.

i wondering however, if possible use directory c++ file created variable in 1 of templates? i'm asking because structure source files in java/package-type fashion.

all files in "utils" directory part of "utils" namespace, packages in "ui" directory part of "ui" namespace etc...

so wondering if there's way me obtain parent directory of file can use in template? (maybe setting variable in cmakelists.txt?)

here's example of i'd achieve

#parse("c file header.h") #[[#ifndef]]# ${include_guard} #[[#define]]# ${include_guard}  ${namespaces_open} namespace ${cwd}  class ${name} {  };  ${namespaces_close}  #[[#endif]]# //${include_guard} 

where ${cwd} represents folder file in.

the ${namespace_open} , ${namespace_close} directives seem purely symbolic clion, websites lists "indicates beginning/end of namespace block created during refactoring."


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -