io.directories.unix: make copy-file copy perms

Like the docs claim it does
db4
Joe Groff 2011-11-18 18:38:39 -08:00
parent cca526df73
commit 7754ab2c06
1 changed files with 5 additions and 2 deletions

View File

@ -5,7 +5,8 @@ combinators continuations destructors fry io io.backend
io.directories io.encodings.binary io.directories io.encodings.binary
io.encodings.utf8 io.files io.pathnames io.files.types kernel io.encodings.utf8 io.files io.pathnames io.files.types kernel
math.bitwise sequences system unix unix.stat vocabs.loader math.bitwise sequences system unix unix.stat vocabs.loader
classes.struct unix.ffi literals libc vocabs ; classes.struct unix.ffi literals libc vocabs
io.files.info.unix ;
IN: io.directories.unix IN: io.directories.unix
CONSTANT: file-mode 0o0666 CONSTANT: file-mode 0o0666
@ -30,7 +31,9 @@ M: unix delete-directory ( path -- )
normalize-path [ rmdir ] unix-system-call drop ; normalize-path [ rmdir ] unix-system-call drop ;
M: unix copy-file ( from to -- ) M: unix copy-file ( from to -- )
[ normalize-path ] bi@ call-next-method ; [ normalize-path ] bi@
[ call-next-method ]
[ [ file-permissions ] dip swap set-file-permissions ] 2bi ;
: with-unix-directory ( path quot -- ) : with-unix-directory ( path quot -- )
[ opendir dup [ (io-error) ] unless ] dip [ opendir dup [ (io-error) ] unless ] dip