diff --git a/src/cryogen_core/classpath_able_io/jar.clj b/src/cryogen_core/classpath_able_io/jar.clj index d35a5b9..a2fda35 100644 --- a/src/cryogen_core/classpath_able_io/jar.clj +++ b/src/cryogen_core/classpath_able_io/jar.clj @@ -52,7 +52,11 @@ [& path-elements ;:- VirtualPath ] (try - (let [resource-uri (.toURI (io/resource (st/join "/" path-elements)))] + (let [resource-uri + (.toURI (io/resource + (st/join "/" + (filter #(not (empty? %)) + path-elements))))] (when (is-from-classpath-jar? resource-uri) (init-file-system resource-uri)) ;; TODO: hier steckt auch eine "from-fs-cp" funktionalität drinne @@ -91,6 +95,7 @@ (.entries (jar-file-for-resource resource)))))) +; TODO: Statt rekursion list-entries-for-dir direkt verwenden (defn get-resources;:- [Resource] [base-path ;:- VirtualPath paths ;:- [VirtualPath] @@ -101,8 +106,8 @@ (do (let [path-to-work-with (first paths) resource-to-work-with (create-resource - (path-if-exists base-path path-to-work-with) - path-to-work-with) + path-to-work-with + (path-if-exists base-path path-to-work-with)) result (into result [resource-to-work-with])] (cond diff --git a/test/cryogen_core/classpath_able_io/jar_test.clj b/test/cryogen_core/classpath_able_io/jar_test.clj index 94f0c6d..314c301 100644 --- a/test/cryogen_core/classpath_able_io/jar_test.clj +++ b/test/cryogen_core/classpath_able_io/jar_test.clj @@ -28,7 +28,7 @@ (deftest test-get-resources (is - (= [{:virtual-path "dummy" :source-type :filesystem :resource-type :dir} - {:virtual-path "dummy/dummy_from_jar" :source-type :filesystem :resource-type :file}] + (= [{:virtual-path "dummy" :source-type :java-classpath-jar :resource-type :dir} + {:virtual-path "dummy/dummy_from_jar" :source-type :java-classpath-jar :resource-type :file}] (map ftt/filter-object (sut/get-resources "" ["dummy"])))))