Hello janAkali.
I have adapted your code to my needs and, indeed, dispensing with 'from' and
'import', it works fine. thank you very much! :-) :-)
In any case, how easy it would have been to have a command/symbol in Nim so
that, as in other languages, placing it before the constant containing the path
of the file that has the resource to use, it would have interpreted it as such.
For example, with the @ symbol: from @FilePathConstant import ResourceName
Explanation of janAkali's macro adaptation:
Source file macros.nim:
macro importVar*(filename, varname: static string): untyped =
result = newStmtList(
nnkFromStmt.newTree(
newIdentNode(filename), newIdentNode(varname)
)
)
Source file paths.nim:
const
ANIMAL_DATA_INPUT* =
"/home/afs3/Testing/Nim/ProjectMVC/03Views/AnimalDataInput" =
"/home/afs3/Testing/Nim/ProjectMVC/03Views/AnimalDataInput".
RESOURCE* =
"inputValuesInFields" =
"/home/afs3/Tests/Nim/ProjectMVC/03Views/inputAnimalData".
Source file in progress: import "folderLibs/paths". import "folderLibs/macros".
importVar(INPUT_ANIMAL_DATA, RESOURCE)
Best regards. Antonio F.S.
P.S.: I don't know how to get the code formatted correctly in this messaging
system.