DEV Community

Discussion on: Rust working with paths

Collapse
 
juancarlospaco profile image
Juan Carlos

Nim lang one-liner Std Lib:

import os
echo getCurrentDir() / paramStr(1)

Use:

nim c -r file.nim param
/home/juan/param

(Its 2 Lines, but import can be passed on command with --import:os, so is 1)

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Passing command line imports that's cheeting, still two lines just injected haha. I got the rust thing working thanks to Ben.

Collapse
 
juancarlospaco profile image
Juan Carlos

But you dont have to pass command line imports, you can use a file.nim.cfg:

--import:os

But it was not about Code Golf anyways.
👑

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Well played 😁