Fork me on GitHub
#jvm
<
2018-02-13
>
stardiviner15:02:50

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

stardiviner15:02:15

I want to use it to change Incanter's generated plot image save path.

stardiviner15:02:55

Because I do Emacs Org-mode Babel literate programming like this: https://github.com/stardiviner/ob-clojure-literate

stardiviner15:02:50

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.

stardiviner15:02:16

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

Alex Miller (Clojure team)15:02:03

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.