1.2.0 permalink Arrow_down_16x16
  • (file-str & args)
Concatenates args as strings and returns a java.io.File. Replaces
all / and \ with File/separatorChar. Replaces ~ at the start of
the path with the user.home system property.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/duck_streams.clj:88 top

(defn ^File file-str
  "Concatenates args as strings and 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 (.replaceAll (re-matcher #"[/\\]" s) File/separator)
        s (if (.startsWith s "~")
            (str (System/getProperty "user.home")
                 File/separator (subs s 1))
            s)]
    (File. s)))
Vars in clojure.contrib.duck-streams/file-str: defn let
Used in 0 other vars

Comments top

No comments for file-str. Log in to add a comment.