io/resource should return nil for non-relative paths
This commit is contained in:
parent
64f3d2cc7b
commit
26939ff677
2 changed files with 6 additions and 2 deletions
|
|
@ -481,7 +481,9 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that
|
|||
(assoc-in ['clojure.java.io 'resource]
|
||||
(fn [path]
|
||||
(when-let [{:keys [:loader]} @cp-state]
|
||||
(cp/getResource loader [path] {:url? true}))))
|
||||
(try (cp/getResource loader [path] {:url? true})
|
||||
;; non-relative paths don't work
|
||||
(catch Exception _e nil)))))
|
||||
(assoc-in ['user (with-meta '*input*
|
||||
(when-not stream?
|
||||
{:sci.impl/deref! true}))] input-var)
|
||||
|
|
|
|||
|
|
@ -55,4 +55,6 @@
|
|||
(.deleteOnExit tmp-file)
|
||||
(bb nil "--classpath" "logo" "-e" (format "(io/copy (io/input-stream (io/resource \"icon.png\")) (io/file \"%s\"))" (.getPath tmp-file)))
|
||||
(is (= (.length (io/file "logo" "icon.png"))
|
||||
(.length tmp-file)))))
|
||||
(.length tmp-file))))
|
||||
(testing "No exception on absolute path"
|
||||
(is (nil? (bb nil "(io/resource \"/tmp\")")))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue