diff --git a/src/clj_jtwig/core.clj b/src/clj_jtwig/core.clj index 496c043..147095f 100644 --- a/src/clj_jtwig/core.clj +++ b/src/clj_jtwig/core.clj @@ -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] diff --git a/src/clj_jtwig/utils.clj b/src/clj_jtwig/utils.clj index 930e4c7..8fe7e66 100644 --- a/src/clj_jtwig/utils.clj +++ b/src/clj_jtwig/utils.clj @@ -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