1 ; Common utility functions used by scripts
3 (import '[java.nio.file Files FileSystems CopyOption StandardCopyOption])
5 (require '[babashka.process :as p] '[org.httpkit.client :as http])
14 (defn extract-file-from-zip
15 [zip-file-name source destination]
16 (let [zip-file (io/file zip-file-name)
18 dest (io/file destination)
19 fs (FileSystems/newFileSystem (.toPath zip-file) nil)
20 file-in-zip (.getPath fs source (into-array String []))]
21 (Files/copy file-in-zip
23 (into-array CopyOption [StandardCopyOption/REPLACE_EXISTING]))))
27 (if (.startsWith s "~")
28 (clojure.string/replace-first s "~" (System/getProperty "user.home"))
33 (io/copy (:body @(http/get url)) (io/file destination)))