mirror of
https://github.com/janet-lang/janet
synced 2024-11-19 15:14:48 +00:00
copyfile should copy permission bits
This commit is contained in:
parent
8fca6b7af4
commit
f4fd481415
@ -4019,12 +4019,13 @@
|
||||
|
||||
(defn- copyfile
|
||||
[from to]
|
||||
(def mode (os/stat from :permissions))
|
||||
(def b (buffer/new 0x10000))
|
||||
(with [ffrom (file/open from :rb)]
|
||||
(with [fto (file/open to :wb)]
|
||||
(forever
|
||||
(file/read ffrom 0x10000 b)
|
||||
(when (empty? b) (buffer/trim b) (break))
|
||||
(when (empty? b) (buffer/trim b) (os/chmod to mode) (break))
|
||||
(file/write fto b)
|
||||
(buffer/clear b)))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user