Retief
Retief

Reputation: 3217

Changing Cake's current directory

Is it possible to configure Cake such that, if test.clj looks like this:

(use 'java.io.File)
(println (.getAbsolutePath (File. ".")))

running cake run test.clj will print the current directory, not /home/retief/.cake/. ?

Running clojure test.clj works properly, with my custom (and very simple) clojure script, but this requires me to start a new jvm every time. Being able to use cake to avoid this and keep my current directory would be useful.

I recognize that using cake within an actual clojure project sets the current directory to the project root, but I am trying to find something that would work for more general scripting tasks.

Upvotes: 1

Views: 742

Answers (1)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91534

Cake's persistent JVM doesn't see what directory the client-cake-process is in at the time of your call because the JVM is already running. It will likely be simpler to design your scripts to take the path as an argument.

ps: Cake and leiningen are merging anyway.

Upvotes: 1

Related Questions