diff options
author | vincentdarley <vincentdarley> | 2002-06-12 09:28:58 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-06-12 09:28:58 (GMT) |
commit | 85fa4c1014f2115447bba5458e877fe974f04f1b (patch) | |
tree | 0c1a8deaa9b8d015e4714b9ce7fb77926a4d499c /unix/tclUnixFile.c | |
parent | c1e47417bf2cab1cb467c456f990114f78ad1680 (diff) | |
download | tcl-85fa4c1014f2115447bba5458e877fe974f04f1b.zip tcl-85fa4c1014f2115447bba5458e877fe974f04f1b.tar.gz tcl-85fa4c1014f2115447bba5458e877fe974f04f1b.tar.bz2 |
fs clarification and windows fixes
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r-- | unix/tclUnixFile.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 5eca8e7..2fd7b11 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFile.c,v 1.20 2002/05/02 20:15:20 vincentdarley Exp $ + * RCS: @(#) $Id: tclUnixFile.c,v 1.21 2002/06/12 09:28:58 vincentdarley Exp $ */ #include "tclInt.h" @@ -728,11 +728,21 @@ TclpObjLink(pathPtr, toPtr) Tcl_Obj *pathPtr; Tcl_Obj *toPtr; { - Tcl_Obj* linkPtr = NULL; - if (toPtr != NULL) { - return NULL; + CONST char *src = Tcl_FSGetNativePath(pathPtr); + CONST char *target Tcl_FSGetNativePath(toPtr); + + if (src == NULL || target == NULL) { + return NULL; + } + if (symlink(src, target) != 0) { + return NULL; + } else { + return toPtr; + } } else { + Tcl_Obj* linkPtr = NULL; + char link[MAXPATHLEN]; int length; char *native; @@ -753,10 +763,12 @@ TclpObjLink(pathPtr, toPtr) strncpy(native, link, (unsigned)length); native[length] = '\0'; - linkPtr = Tcl_FSNewNativePath(pathPtr, native); - Tcl_IncrRefCount(linkPtr); + linkPtr = Tcl_FSNewNativePath(&nativeFilesystem, native); + if (linkPtr != NULL) { + Tcl_IncrRefCount(linkPtr); + } + return linkPtr; } - return linkPtr; } #endif |