coding conventions & unused parts removed

This commit is contained in:
jem 2020-01-17 18:50:13 +01:00
parent 25bb5b259c
commit 72e8eec3d5
2 changed files with 5 additions and 5 deletions

View file

@ -19,8 +19,6 @@
(def Prefix s/Str) (def Prefix s/Str)
(def FilesystemUri s/Any) ; java.net.URI
(def ResourceUri s/Any) ; java.net.URI (def ResourceUri s/Any) ; java.net.URI
(def ShortPath s/Str) (def ShortPath s/Str)
@ -77,9 +75,9 @@
[resource :- Resource] [resource :- Resource]
(= :file (:resource-type resource))) (= :file (:resource-type resource)))
(s/defn init-FileSystem (s/defn init-file-system
[resource-uri :- ResourceUri] [resource-uri :- ResourceUri]
(let [path-to-filesystem (st/join (pop (st/split (.toString resource-uri) #"!")))] (let [path-to-filesystem (pop (st/split (.toString resource-uri) #"!"))]
(try (try
(FileSystems/newFileSystem (FileSystems/newFileSystem
(java.net.URI. path-to-filesystem) (java.net.URI. path-to-filesystem)
@ -93,7 +91,7 @@
(try (try
(let [resource-uri (.toURI (io/resource resource-path))] ; check if contains jar: (let [resource-uri (.toURI (io/resource resource-path))] ; check if contains jar:
(when (st/starts-with? (.toString resource-uri) "jar:") (when (st/starts-with? (.toString resource-uri) "jar:")
(init-FileSystem resource-uri)) (init-file-system resource-uri))
(when (Files/exists (Paths/get resource-uri) NoLinkOption) (when (Files/exists (Paths/get resource-uri) NoLinkOption)
(Paths/get resource-uri))) (Paths/get resource-uri)))
(catch Exception e (catch Exception e

View file

@ -23,6 +23,8 @@
(def NoLinkOption (into-array [LinkOption/NOFOLLOW_LINKS])) (def NoLinkOption (into-array [LinkOption/NOFOLLOW_LINKS]))
(sut/init-file-system (io/resource "dummy"))
; TODO: Fix this test! ; TODO: Fix this test!
(deftest test-file-from-cp (deftest test-file-from-cp
(is (is