Works in filesystem and from jar. Updated docs to recognise that the scale-and-zoom issue is fixed.
This commit is contained in:
Simon Brooke 2020-01-29 20:28:12 +00:00
parent 5ded76199f
commit f8c05e5668
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
5 changed files with 11 additions and 18 deletions

View file

@ -6,6 +6,7 @@
[clojure.java.io :as io]
[clojure.string :as s]
[clojure.tools.logging :as log]
[cpath-clj.core :as cp]
[compojure.core :refer [defroutes GET POST]]
[csv2edn.csv2edn :refer :all]
[noir.response :as nresponse]
@ -37,19 +38,18 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn get-pin-image-names
"Return the category names for which we have pin images; `request` is ignored.
This looks odd - why not file-seq over the directory? - but the answer is we
may be running in a jar file, and if we are that will fail."
[request]
(ar/do-or-server-fail
(map
#(s/replace (.getName %) #"-pin\.png$" "")
(let [grammar-matcher (.getPathMatcher
(java.nio.file.FileSystems/getDefault)
"glob:*-pin.png")]
#(s/replace (s/replace (str %) #"-pin\.png$" "") "/" "")
(->> "public/img/map-pins"
io/resource
io/file
file-seq
(filter #(.isFile %))
(filter #(.matches grammar-matcher (.getFileName (.toPath %)))))))
cp/resources
keys
(filter #(re-find #".*-pin.png" %))))
200))
(defn get-data-uri