Skip to content

Commit

Permalink
Add function to join paths
Browse files Browse the repository at this point in the history
  • Loading branch information
wwentland authored and Raynes committed Apr 10, 2012
1 parent 3214cd3 commit 6e643d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fs/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,8 @@ If 'trim-ext' is true, any extension is trimmed."
(.. (.replaceAll (str path) "\\.clj" "")
(replace \_ \-)
(replace \/ \.))))

(defn join
"Join one or more path components."
[& paths]
(.getPath (apply io/file paths)))
4 changes: 4 additions & 0 deletions test/fs/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,7 @@
(absolute? "/foo/") => true
(absolute? "foo/bar") => false
(absolute? "foo/") => false)

(fact
(join "foo" "bar" "baz") => "foo/bar/baz"
(join "foo") => "foo")

0 comments on commit 6e643d4

Please sign in to comment.