I want to change Clojure current working directory. But after a search, found not possible except one try: https://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java#840229
I want to use it to change Incanter
's generated plot image save path.
Because I do Emacs Org-mode Babel literate programming like this: https://github.com/stardiviner/ob-clojure-literate
I tried (System/setProperty "user.dir" "/home/stardiviner")
, and get this property (System/getProperty "user.dir")
. The value did changed. But Incanter
's save
still save into the project root directory.
I found newprops.put("user.dir", "/etc");
in https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4045688 But don't know how to call it in Clojure
I don’t think there is any way to change the current directory of the jvm process (for good reasons outlined in that ticket). Surely Incanter’s api allows you to specify where you wish to save images though and I would suggest changing that instead.