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.
(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]
[java.nio.file Paths Files LinkOption]))
@ -29,7 +29,14 @@
(defn path-if-exists
[& 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)
path-from-fs)))
@ -76,9 +83,9 @@
[resource-to-work-with])]
(cond
(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)
(type/is-dir? resource-to-work-with)
(this/is-dir? resource-to-work-with)
(recur (into (drop 1 paths)
(map #(str path-to-work-with "/" %)
(list-entries-for-dir resource-to-work-with)))

View file

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