On Mon, Apr 6, 2009 at 10:40 AM, James Reeves
<weavejes...@googlemail.com> wrote:
>
> On Apr 6, 4:10 am, Stuart Sierra <the.stuart.sie...@gmail.com> wrote:
>> I don't see an obvious way of combining them.
>
> What about something like:
>
> (defn- normalize-separator
>  [filepath]
>  (.. (str filepath)
>    (replace \\ File/separatorChar)
>    (replace \/ File/separatorChar)))

What?  You mean I won't be able to use backslashes in my filenames
anymore? :)  (Yes, a backslash is perfectly legal in a filename on
Unix filesystems, although I agree it's probably not a good idea to
use them.)

> (defn file
>  [filepath & more]
>  (reduce
>    (fn [parent path] (File. parent path))
>    (File. (normalize-separator filepath))
>    (map normalize-separator more)))

-- 
Michael Wood <esiot...@gmail.com>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to