add make-hard-link to io.files.links

db4
Doug Coleman 2009-04-28 22:51:35 -05:00
parent 08b7ec67c6
commit 2d0925d995
4 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,10 @@ HELP: make-link
{ $values { "target" "a path to the symbolic link's target" } { "symlink" "a path to new symbolic link" } }
{ $description "Creates a symbolic link." } ;
HELP: make-hard-link
{ $values { "target" "a path to the hard link's target" } { "link" "a path to new symbolic link" } }
{ $description "Creates a hard link." } ;
HELP: read-link
{ $values { "symlink" "a path to an existing symbolic link" } { "path" "the path pointed to by the symbolic link" } }
{ $description "Reads the symbolic link and returns its target path." } ;

View File

@ -6,6 +6,8 @@ IN: io.files.links
HOOK: make-link os ( target symlink -- )
HOOK: make-hard-link os ( target link -- )
HOOK: read-link os ( symlink -- path )
: copy-link ( target symlink -- )

View File

@ -7,6 +7,9 @@ IN: io.files.links.unix
M: unix make-link ( path1 path2 -- )
normalize-path symlink io-error ;
M: unix make-hard-link ( path1 path2 -- )
normalize-path link io-error ;
M: unix read-link ( path -- path' )
normalize-path read-symbolic-link ;

View File

@ -194,6 +194,7 @@ FUNCTION: int setsockopt ( int s, int level, int optname, void* optval, socklen_
FUNCTION: int setuid ( uid_t uid ) ;
FUNCTION: int socket ( int domain, int type, int protocol ) ;
FUNCTION: int symlink ( char* path1, char* path2 ) ;
FUNCTION: int link ( char* path1, char* path2 ) ;
FUNCTION: int system ( char* command ) ;
FUNCTION: int unlink ( char* path ) ;