Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn- ^File path-cat
- "Concatenate a path onto a file, with the same semantics as 'file."
- [f p]
- {:pre [f, p], :post [(cast File %)]}
- (let [f2 (io/file p)]
- (if (.isAbsolute f2) (io/file p) (io/file f p))))
- (defn ^File file
- "Concatenate one or more paths. Absolute paths overrule all previous paths.
- Concatenating a/b/c with /d/e/f results in /d/e/f."
- [path & more]
- {:pre [path], :post [(cast File %)]}
- (let [f (io/file path)]
- (if (empty? more) (io/file f) (reduce path-cat f more))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement