do not need allways a new fs
This commit is contained in:
parent
72e8eec3d5
commit
02f9c57612
1 changed files with 5 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue