1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io.backend io.files io.files.links io.pathnames kernel
4 sequences system unix unix.ffi ;
5 IN: io.files.links.unix
7 M: unix make-link ( path1 path2 -- )
8 normalize-path [ symlink ] unix-system-call drop ;
10 M: unix make-hard-link ( path1 path2 -- )
11 normalize-path [ link ] unix-system-call drop ;
13 M: unix read-link ( path -- path' )
14 normalize-path read-symbolic-link ;
16 M: unix resolve-symlinks ( path -- path' )
18 [ append-path dup exists? [ follow-links ] when ] reduce ;