diff options
author | vincentdarley <vincentdarley@noemail.net> | 2002-07-15 10:28:16 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley@noemail.net> | 2002-07-15 10:28:16 (GMT) |
commit | 9d9a47dc03a4f7137837a0de8d034e8d930a21c6 (patch) | |
tree | 5045065add47602c2723824a3af822079c935b04 /mac | |
parent | ece80933ccc1aa52433cdd88effb434243678e76 (diff) | |
download | tcl-9d9a47dc03a4f7137837a0de8d034e8d930a21c6.zip tcl-9d9a47dc03a4f7137837a0de8d034e8d930a21c6.tar.gz tcl-9d9a47dc03a4f7137837a0de8d034e8d930a21c6.tar.bz2 |
mac TclpObjlink implementation
FossilOrigin-Name: fe515d89e28e8e6e6cce0b2ca99a3ead3127f2b7
Diffstat (limited to 'mac')
-rw-r--r-- | mac/tclMacFile.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c index a25c5db..248dc94 100644 --- a/mac/tclMacFile.c +++ b/mac/tclMacFile.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacFile.c,v 1.23 2002/06/21 14:22:29 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacFile.c,v 1.24 2002/07/15 10:28:18 vincentdarley Exp $ */ /* @@ -1169,7 +1169,30 @@ TclpObjLink(pathPtr, toPtr, linkAction) if (linkAction & TCL_CREATE_SYMBOLIC_LINK) { /* Needs to create a new link */ - return NULL; + FSSpec spec; + FSSpec linkSpec; + OSErr err; + char *path; + AliasHandle alias; + + err = FspLocationFromFsPath(toPtr, &spec); + if (err != noErr) { + errno = ENOENT; + return NULL; + } + + path = Tcl_FSGetNativePath(pathPtr); + err = FSpLocationFromPath(strlen(path), path, &linkSpec); + if (err == noErr) { + err = dupFNErr; /* EEXIST. */ + } else { + err = NewAlias(&spec, &linkSpec, &alias); + } + if (err != noErr) { + errno = TclMacOSErrorToPosixError(err); + return NULL; + } + return toPtr; } else { errno = ENODEV; return NULL; |