extract function to check if file exists
this will need to be extended to also check for the existance of files inside of jars
This commit is contained in:
parent
91b71370bf
commit
f68862e784
|
@ -73,7 +73,7 @@
|
|||
; this function really only exists so i can easily change the exception type / message in the future
|
||||
; since this file-exists check is needed in a few places
|
||||
(defn- err-if-no-file [^File file]
|
||||
(if-not (.exists file)
|
||||
(if-not (exists? file)
|
||||
(throw (new FileNotFoundException (str "Template file \"" file "\" not found.")))))
|
||||
|
||||
(defn- cache-compiled-template! [^File file create-fn]
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
; the path of a file inside a jar looks something like "jar:file:/path/to/file.jar!/path/inside/jar/to/file"
|
||||
(.contains "jar!")))
|
||||
|
||||
(defn exists? [^File file]
|
||||
(if (inside-jar? file)
|
||||
;; TODO: can't use File.exists() for this
|
||||
true
|
||||
(.exists file)))
|
||||
|
||||
(defn get-file-last-modified [^File file]
|
||||
(if (inside-jar? file)
|
||||
0
|
||||
|
|
Reference in a new issue