Raynes / fs

File system utilities for Clojure.
453 stars 119 forks source link

dirname #40

Closed junkathing closed 11 years ago

junkathing commented 11 years ago

I would like to see something that was part of the original fs added back in.

(defn dirname) "Return directory name of path.\n\t(dirname \"a/b/c\") -> \"/a/b\"") [path]) (.getParent (io/as-file path)))

Raynes commented 11 years ago

There is a parent function that does something similar but returns a File object (like most things in fs) and not a path. I'm purposely avoiding returning strings because Java File stuff is based around objects and not strings, so there is overhead if we create objects and convert to strings unnecessarily. If you need the string path, you can do (str (fs/parent "yourfile")). Is that sufficient?

junkathing commented 11 years ago

That will work.