diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2008-12-19 16:49:42 +0000 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2008-12-19 16:49:42 +0000 |
commit | d8f4b52e4b5b0e7b87448939423c34988c7438dc (patch) | |
tree | 62ca3cb02dd99d70483c2baf5d524cca6f5590a1 /src | |
parent | cf2be204e8fc112d94716e966b92b5e02d596686 (diff) |
duck_streams.clj: move 'file' to top so it compiles
Diffstat (limited to 'src')
-rw-r--r-- | src/clojure/contrib/duck_streams.clj | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/clojure/contrib/duck_streams.clj b/src/clojure/contrib/duck_streams.clj index 27964262..d89f5bca 100644 --- a/src/clojure/contrib/duck_streams.clj +++ b/src/clojure/contrib/duck_streams.clj @@ -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)) @@ -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))) |