summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2002-07-15 10:28:16 (GMT)
committervincentdarley <vincentdarley>2002-07-15 10:28:16 (GMT)
commitc5fcdc88889a47d5bbb0c61ec6ca2eb6ad151b5b (patch)
tree5045065add47602c2723824a3af822079c935b04
parent6d25f463a9b9b44911034abb4178b9ea4a4267f4 (diff)
downloadtcl-c5fcdc88889a47d5bbb0c61ec6ca2eb6ad151b5b.zip
tcl-c5fcdc88889a47d5bbb0c61ec6ca2eb6ad151b5b.tar.gz
tcl-c5fcdc88889a47d5bbb0c61ec6ca2eb6ad151b5b.tar.bz2
mac TclpObjlink implementation
-rw-r--r--ChangeLog2
-rw-r--r--mac/tclMacFile.c27
2 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ba090ec..b2a2ffb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
* win/tclWinFile.c: updated comments to reflect 07-11 changes.
* win/tclWinFCmd.c: made ConvertFileNameFormat static again,
since no longer used in tclWinFile.c
+ * mac/tclMacFile.c: completed TclpObjLink implementation which
+ was previously lacking.
2002-07-14 Don Porter <dgp@users.sourceforge.net>
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;