Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Babashka [fs](https://github.com/babashka/fs): file system utility library for C
- [#181](https://github.com/babashka/fs/issues/181) `delete-tree` now deletes broken symbolic link `root` ([@lread](https://github.com/lread))
- [#188](https://github.com/babashka/fs/issues/188) `copy-tree` now throws if `src` or `dest` is a symbolic link when not following links ([@lread](https://github.com/lread))
- [#193](https://github.com/babashka/fs/issues/193) `create-dirs` now recognizes sym-linked dirs on JDK 11 ([@lread](https://github.com/lread))
- [#201](https://github.com/babashka/fs/issues/201) `gzip` now accepts `source-file` `Path` ([@lread](https://github.com/lread))


## 0.5.30 (2025-11-25)

Expand Down
2 changes: 1 addition & 1 deletion src/babashka/fs.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@
(str out-file))
new-path (.resolve output-path dest-filename)]
(create-dirs (parent new-path))
(with-open [source-input-stream (io/input-stream source-file)
(with-open [source-input-stream (io/input-stream (file source-file))
gzos (GZIPOutputStream.
(FileOutputStream. (file new-path)))]
(io/copy source-input-stream
Expand Down
16 changes: 15 additions & 1 deletion test/babashka/fs_cwd_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[babashka.fs :as fs]
[babashka.test-report]
[clojure.string :as str]
[clojure.test :refer [deftest is use-fixtures]]
[clojure.test :refer [deftest is testing use-fixtures]]
[matcher-combinators.test]))

(use-fixtures :each
Expand Down Expand Up @@ -698,3 +698,17 @@
(fs/create-sym-link "good-link2" "dir2")

(is (thrown-with-msg? java.nio.file.FileAlreadyExistsException #"good-link2" (fs/move "good-link1" "good-link2")))))

;; misc -- will merge into fs-test as part of https://github.com/babashka/fs/issues/158

(deftest gzip-arg-types-test
(spit "foo.txt" "foo")
(doseq [arg-type [:str :file :path]]
(testing (str "args type: " (name arg-type))
(let [arg-fn (arg-type {:str identity :file fs/file :path fs/path})]
(is (= (str (fs/path "./foo.txt.gz"))
(fs/gzip (arg-fn "foo.txt"))))
(is (= (str (fs/path "out-dir" "foo.txt.gz"))
(fs/gzip (arg-fn "foo.txt") {:dir (arg-fn "out-dir")})))
(is (= (str (fs/path "out-dir" "bar.txt.gz"))
(fs/gzip (arg-fn "foo.txt") {:dir (arg-fn "out-dir") :out-file "bar.txt.gz"})))))))