Skip to content

Commit

Permalink
Merge pull request #4 from arichiardi/directory-default
Browse files Browse the repository at this point in the history
Add :default case for directory? (fixes #1)
  • Loading branch information
weavejester committed Feb 20, 2017
2 parents 7b57ec8 + 27a4314 commit eb5762c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/resauce/core.clj
Expand Up @@ -38,6 +38,9 @@
entry (.getEntry jar (add-ending-slash path))]
(and entry (.isDirectory entry))))

(defmethod directory? :default [url]
false)

(defmulti url-dir
"Return a list of URLs contained by this URL, if the protocol supports it."
{:arglists '([url])}
Expand Down
3 changes: 2 additions & 1 deletion test/resauce/core_test.clj
Expand Up @@ -7,7 +7,8 @@
(is (directory? (io/resource "resauce")))
(is (directory? (io/resource "clojure")))
(is (not (directory? (io/resource "resauce/core.clj"))))
(is (not (directory? (io/resource "clojure/core.clj")))))
(is (not (directory? (io/resource "clojure/core.clj"))))
(is (not (directory? nil))))

(deftest test-resources
(let [rs (sort (map str (resources "resauce")))]
Expand Down

0 comments on commit eb5762c

Please sign in to comment.