I've written a little internal webapp that I use to import invoices from our jobcard database into MYOB. I've written it using Clojure and Compojure, and it actually works pretty well, and it was also a good learning exercise for me.
However, I've got a problem, it seems that after a successful invoice import the jetty server will no longer serve the static CSS file.
The defroute is as follows:
(defroutes static-routes
(GET ["/:filename" :filename #".*"] [filename]
(response/file-response filename {:root "public"})))
(The file is just css/default.css, it works just perfectly before the first import.)
Now I think I've found the problem, it seems that the MYOB ODBC driver is changing the working directory of the Jetty server (and my REPL), because when I enter the following in the REPL:
(file-seq (File. "."))
I get a listing of my Temp files directory, which would explain why my CSS file is no longer being found.
The odd thing is, if I do:
(.getAbsolutePath (File. "."))
I get the correct directory of my application.
Does anyone know of something (other than coding in an absolute path) that can get around this quirk of the MYOB ODBC driver?
I'm guessing that I could just grab and store the absolute path when I start up, but would that work with an uberjar?
Edit: It seems that it is impossible to fix due to limitations in the JVM?
http://stackoverflow.com/questions/3921744/how-do-i-change-directory-in-command-line-with-clojure