Leinigen resources and uberjar

less than 1 minute read

Problem concerning the copy of a resource file.

    [clojure.java.io :as io])
    [org.apache.commons.io FileUtils])

(defn copy-template
  "Copy the template file to the same directory of the given filepath and rename it
  with the same name of the given filepath, but using XLS extension."
  (let [template (log/spy (io/resource "template.xls"))
        out-path (s/replace fpath #"\.\w+$" ".xls")] 
    (FileUtils/copyURLToFile template (io/file out-path))