copy-tree now preserves file permissions on Unix

db4
Slava Pestov 2009-05-14 17:36:07 -05:00
parent 606ed8aaa1
commit 1214e22839
3 changed files with 10 additions and 3 deletions
basis/io
directories/hierarchy

View File

@ -20,7 +20,7 @@ DEFER: copy-tree-into
{
{ +symbolic-link+ [ copy-link ] }
{ +directory+ [ '[ [ _ copy-tree-into ] each ] with-directory-files ] }
[ drop copy-file ]
[ drop copy-file-and-info ]
} case ;
: copy-tree-into ( from to -- )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman, Eduardo Cavazos.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel system sequences combinators
vocabs.loader io.files.types math ;
vocabs.loader io.files.types io.directories math ;
IN: io.files.info
! File info
@ -29,3 +29,7 @@ HOOK: file-system-info os ( path -- file-system-info )
{ [ os unix? ] [ "io.files.info.unix." os name>> append ] }
{ [ os windows? ] [ "io.files.info.windows" ] }
} cond require
HOOK: copy-file-and-info os ( from to -- )
M: object copy-file-and-info copy-file ;

View File

@ -3,7 +3,7 @@
USING: accessors kernel system math math.bitwise strings arrays
sequences combinators combinators.short-circuit alien.c-types
vocabs.loader calendar calendar.unix io.files.info
io.files.types io.backend unix unix.stat unix.time unix.users
io.files.types io.backend io.directories unix unix.stat unix.time unix.users
unix.groups ;
IN: io.files.info.unix
@ -174,6 +174,9 @@ CONSTANT: OTHER-EXECUTE OCT: 0000001
: file-permissions ( path -- n )
normalize-path file-info permissions>> ;
M: unix copy-file-and-info ( from to -- )
[ copy-file ] [ swap file-permissions set-file-permissions ] 2bi ;
<PRIVATE
: make-timeval-array ( array -- byte-array )