X-Git-Url: https://njoseph.me/gitweb/babashka-scripts.git/blobdiff_plain/0b0f2aa39a06e77b1517f895a2c82946f684b568..HEAD:/lib.clj diff --git a/lib.clj b/lib.clj deleted file mode 100644 index 8978c3a..0000000 --- a/lib.clj +++ /dev/null @@ -1,20 +0,0 @@ -; Common utility functions used by scripts - -(import '[java.nio.file Files FileSystems CopyOption StandardCopyOption]) - -(defn extract-file-from-zip - [zip-file-name source destination] - (let [zip-file (io/file zip-file-name) - src (io/file source) - dest (io/file destination) - fs (FileSystems/newFileSystem (.toPath zip-file) nil) - file-in-zip (.getPath fs source (into-array String []))] - (Files/copy file-in-zip - (.toPath dest) - (into-array CopyOption [StandardCopyOption/REPLACE_EXISTING])))) - -(defn expand-home - [s] - (if (.startsWith s "~") - (clojure.string/replace-first s "~" (System/getProperty "user.home")) - s))