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.
(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 (.replace s \\ File/separatorChar)
s (.replace s \/ File/separatorChar)
s (if (.startsWith s "~")
(str (System/getProperty "user.home")
File/separator (subs s 1))
s)]
(File. s)))
Comments top
No comments for file-str. Log in to add a comment.