factor/basis/io/files/links/unix/unix.factor

19 lines
607 B
Factor
Raw Normal View History

! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: io.backend io.files io.files.links io.pathnames kernel
sequences system unix unix.ffi ;
IN: io.files.links.unix
M: unix make-link ( path1 path2 -- )
normalize-path [ symlink ] unix-system-call drop ;
2009-04-28 23:51:35 -04:00
M: unix make-hard-link ( path1 path2 -- )
normalize-path [ link ] unix-system-call drop ;
2009-04-28 23:51:35 -04:00
M: unix read-link ( path -- path' )
normalize-path read-symbolic-link ;
2009-02-18 14:34:45 -05:00
M: unix resolve-symlinks ( path -- path' )
2009-02-18 14:34:45 -05:00
path-components "/"
[ append-path dup exists? [ follow-links ] when ] reduce ;