This commit is contained in:
jem 2020-02-07 20:37:51 +01:00
parent f9aa13c715
commit 3b2d21ad96
2 changed files with 12 additions and 7 deletions

View file

@ -7,7 +7,7 @@
; You must not remove this notice, or any other, from this software. ; You must not remove this notice, or any other, from this software.
(ns cryogen-core.classpath-able-io.fs (ns cryogen-core.classpath-able-io.fs
(:require [cryogen-core.classpath-able-io.this :as type]) (:require [cryogen-core.classpath-able-io.this :as this])
(:import [java.net URI] (:import [java.net URI]
[java.nio.file Paths Files LinkOption])) [java.nio.file Paths Files LinkOption]))
@ -29,7 +29,14 @@
(defn path-if-exists (defn path-if-exists
[& path-elements] [& path-elements]
(let [path-from-fs (Paths/get (URI. (str "file://" (apply absolut-path path-elements))))] (let [path-from-fs
(Paths/get
(URI. (str "file://"
(apply absolut-path
;TODO: sollte hier nicht auch stehen:
;(apply this/virtual-path-from-elements path-elements)
path-elements
))))]
(when (Files/exists path-from-fs follow-link-option) (when (Files/exists path-from-fs follow-link-option)
path-from-fs))) path-from-fs)))
@ -76,9 +83,9 @@
[resource-to-work-with])] [resource-to-work-with])]
(cond (cond
(nil? resource-to-work-with) (recur (drop 1 paths) result) (nil? resource-to-work-with) (recur (drop 1 paths) result)
(type/is-file? resource-to-work-with) (this/is-file? resource-to-work-with)
(recur (drop 1 paths) result) (recur (drop 1 paths) result)
(type/is-dir? resource-to-work-with) (this/is-dir? resource-to-work-with)
(recur (into (drop 1 paths) (recur (into (drop 1 paths)
(map #(str path-to-work-with "/" %) (map #(str path-to-work-with "/" %)
(list-entries-for-dir resource-to-work-with))) (list-entries-for-dir resource-to-work-with)))

View file

@ -57,9 +57,7 @@
(try (try
(let [resource-uri (let [resource-uri
(.toURI (io/resource (.toURI (io/resource
(st/join "/" (apply this/virtual-path-from-elements path-elements)))]
(filter #(not (empty? %))
path-elements))))]
(when (is-from-classpath-jar? resource-uri) (when (is-from-classpath-jar? resource-uri)
(do (do
(init-file-system resource-uri) (init-file-system resource-uri)