Hello. I post below for further clarification, the summary of this thread:

Best regards. Antonio F.S.
    
    
    #[
      Author: janAkali // Forum: -> https://forum.nim-lang.org/
      Date: 28/11/2024
      Description: gets a resource from a Nim source file.
      Example:
        Source file macros.nim:
          import macros
          
          macro importVar*(filename, varname: static string): untyped =
            result = newStmtList(
              nnkFromStmt.newTree(
                newIdentNode(filename),
                newIdentNode(varname)
              )
            )
        
        Source file paths.nim:
          const
            SOURCE_FILE* = "/home/afs3/Nim/Project/Views/SourceResourceFile".
            RESOURCE* =
              "resourceFromSourceFileWithResource".
        
        Current source file:
          import "folderLibs/paths".
          import "folderLibs/macros".
          
          importVar(SOURCE_FILE, RESOURCE)
    ]#
    
    
    Run

Reply via email to