From 02f9c57612973ade85ba29b5082d77b95292a328 Mon Sep 17 00:00:00 2001 From: jem Date: Fri, 17 Jan 2020 19:08:15 +0100 Subject: [PATCH] do not need allways a new fs --- src/cryogen_core/classpath_able_io.clj | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index a32b5ba..f380a0b 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -10,7 +10,8 @@ (:require [clojure.java.io :as io] [clojure.string :as st] [schema.core :as s]) - (:import [java.nio.file FileSystems Paths Files SimpleFileVisitor LinkOption StandardCopyOption] + (:import [java.net Uri] + [java.nio.file FileSystems Paths Files SimpleFileVisitor LinkOption StandardCopyOption] [java.nio.file.attribute FileAttribute])) (def SourceType (s/enum :classpath :filesystem)) @@ -77,13 +78,11 @@ (s/defn init-file-system [resource-uri :- ResourceUri] - (let [path-to-filesystem (pop (st/split (.toString resource-uri) #"!"))] + (let [filesystem-uri (Uri. (pop (st/split (.toString resource-uri) #"!")))] (try - (FileSystems/newFileSystem - (java.net.URI. path-to-filesystem) - {}) + (FileSystems/getFileSystem filesystem-uri) (catch Exception e - nil)))) + (FileSystems/newFileSystem filesystem-uri {}))))) ; contains either a jar or a file (s/defn path-from-cp ; :- JavaPath