Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
duck_streams.clj: move 'file' to top so it compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Sierra committed Dec 19, 2008
1 parent cf2be20 commit d8f4b52
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/clojure/contrib/duck_streams.clj
Expand Up @@ -42,6 +42,21 @@



(defn #^File file
"Concatenates args as strings returns a java.io.File. Replaces all
/ and \\ with File/separatorChar. Replaces ~ at the start of the
path with the user.home system property."
[& args]
(let [#^String s (apply str args)
s (.replace s \/ File/separatorChar)
s (.replace s \\ File/separatorChar)
s (if (.startsWith s "~")
(str (System/getProperty "user.home")
File/separatorChar (subs s 1))
s)]
(File. s)))


(defmacro #^{:private true} bufr [reader]
`(new java.io.BufferedReader ~reader))

Expand Down Expand Up @@ -165,17 +180,3 @@
[f content]
(with-open [#^PrintWriter w (writer f)]
(.print w content)))

(defn #^File file
"Concatenates args as strings returns a java.io.File. Replaces all
/ and \\ with File/separatorChar. Replaces ~ at the start of the
path with the user.home system property."
[& args]
(let [#^String s (apply str args)
s (.replace s \/ File/separatorChar)
s (.replace s \\ File/separatorChar)
s (if (.startsWith s "~")
(str (System/getProperty "user.home")
File/separatorChar (subs s 1))
s)]
(File. s)))

0 comments on commit d8f4b52

Please sign in to comment.