Hello,
I'm trying to figure out the best way to work with paths in NimScript. Here's what I've observed so far:
#!/usr/bin/env nim
echo getCurrentDir()
/Users/martin/.nimble/pkgs2/nim-2.2.8-46b3923a8c0a031bfe29df5c5903c8c4898d338f/lib/std/paths.nim(261, 26) Error: undeclared identifier: 'getCurrentDir'
candidates (edit distance, scope distance); see '--spellSuggest':
(0, 2): 'getCurrentDir'
Can anyone elaborate on:
Thanks!
How/why is getCurrentDir() implicitly imported?
It's implemented in a vm, you can see a stub definition in a nimscript.nim module (implicitly imported): https://github.com/nim-lang/Nim/blob/devel/lib/system/nimscript.nim#L50
If not, what's the canonical way to work with paths in NimScript?
This works:
from std/os import `/`, `/../`
# or just
import std/os