0

You can't use ~ in paths for NodeJS functions because that's a bash-specific thing. So how do you get the path to a user's home directory in Clojurescript (on Node)?

michaelrbock
  • 1,160
  • 1
  • 11
  • 20

1 Answers1

1
(def os (node/require "os"))

(.homedir os)

And to combine it with an additional path:

(def path (node/require "path"))

(.join path (.homedir os) "/directory/file.txt")
michaelrbock
  • 1,160
  • 1
  • 11
  • 20