Skip to content

Instantly share code, notes, and snippets.

@arthuredelstein
Created August 26, 2011 03:50
Show Gist options
  • Save arthuredelstein/1172646 to your computer and use it in GitHub Desktop.
Save arthuredelstein/1172646 to your computer and use it in GitHub Desktop.
user.dir/slurp weirdness
clooj.help=>
(import java.io.File)
java.io.File
clooj.help=>
(System/getProperty "user.dir")
"/projects/clooj"
clooj.help=>
(System/setProperty "user.dir" "/tmp")
"/projects/clooj"
clooj.help=>
(System/getProperty "user.dir")
"/tmp"
clooj.help=>
(.getAbsolutePath (File. "."))
"/tmp/."
clooj.help=>
(spit "test.txt" "where am i?")
nil
clooj.help=>
(.getAbsolutePath (File. "test.txt"))
"/tmp/test.txt"
clooj.help=>
(slurp "test.txt")
"where am i?"
clooj.help=>
(slurp "/projects/clooj/test.txt")
"where am i?"
clooj.help=>
(slurp "/tmp/test.txt")
#<CompilerException java.io.FileNotFoundException: /tmp/test.txt (No such file or directory) (NO_SOURCE_FILE:0)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment