File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 22
33## master (unreleased)
44
5+ ### Bugs fixed
6+
7+ * [ #83 ] ( https://github.com/clojure-emacs/orchard/pull/83 ) : Ignore non file URLs when checking for directory or file extensions.
8+
59## 0.5.6 (2020-02-14)
610
711### Bugs fixed
Original file line number Diff line number Diff line change 2020 []
2121 (not (nil? (boot-fake-classpath ))))
2222
23+ (defn url?
24+ " Check whether the argument is an url"
25+ [u]
26+ (instance? java.net.URL u))
27+
2328(defn directory?
24- " Whether the argument is a directory"
29+ " Whether the argument is a directory or an url that points to a directory "
2530 [f]
26- (.isDirectory (io/as-file f)))
31+ (if (url? f)
32+ (and (= (.getProtocol ^java.net.URL f) " file" )
33+ (.isDirectory (io/as-file f)))
34+ (.isDirectory (io/as-file f))))
2735
2836(defn file-ext?
2937 " Whether the argument's path ends in one of the specified case-insensitive
3038 file extensions"
3139 [f & exts]
32- (let [file (io/as-file f)]
40+ (when-let [file (if (url? f)
41+ (when (= (.getProtocol ^java.net.URL f) " file" )
42+ (io/as-file f))
43+ (io/as-file f))]
3344 (some (fn [ext]
3445 (.endsWith (.. file getName toLowerCase) ext))
3546 exts)))
Original file line number Diff line number Diff line change 5757 (is (nil? (misc/namespace-sym nil )))
5858 (is (= 'unqualified (misc/namespace-sym 'unqualified)))
5959 (is (= 'qualified (misc/namespace-sym 'qualified/sym))))
60+
61+ (deftest file-ext?
62+ (is (misc/file-ext? (java.net.URL. " file:/tmp/foo.jar" ) " .jar" ))
63+ (is (not (misc/file-ext? (java.net.URL. " file:/tmp/foo.war" ) " .jar" )))
64+ (is (not (misc/file-ext? (java.net.URL. " jar:file:/tmp/foo.jar!/BOOT-INF/lib/test.jar" ) " .jar" ))))
65+
66+ (deftest directory?
67+ (is (misc/directory? (.toURL (.toURI (java.io.File. " " ))))))
You can’t perform that action at this time.
0 commit comments