diff options
author | das <das> | 2002-04-19 14:18:33 (GMT) |
---|---|---|
committer | das <das> | 2002-04-19 14:18:33 (GMT) |
commit | 26bb2b5da7f034e47d6544e3d84e54c861f61206 (patch) | |
tree | 323d0314781d4b46fbb081c3751bb12a9e56feb8 /mac/tclMacFile.c | |
parent | d2af1305c613b7c578a4b5be8e1ff487917b4237 (diff) | |
download | tcl-26bb2b5da7f034e47d6544e3d84e54c861f61206.zip tcl-26bb2b5da7f034e47d6544e3d84e54c861f61206.tar.gz tcl-26bb2b5da7f034e47d6544e3d84e54c861f61206.tar.bz2 |
2002-04-20 Daniel Steffen <das@users.sourceforge.net>
* generic/tclInt.decls:
* generic/tclIntPlatDecls.h:
* generic/tclStubInit.c:
* mac/tclMacFCmd.c:
* mac/tclMacFile.c:
* mac/tclMacUtil.c: Modified TclpObjNormalizePath to be alias
file aware, and replaced various calls to FSpLocationFrom*Path
by calls to new alias file aware versions FSpLLocationFrom*Path.
The alias file aware routines don't resolve the last component of
a path if it is an alias. This allows [file copy/delete] etc. to
act correctly on alias files. (c.f. discussion in Bug #511666)
Diffstat (limited to 'mac/tclMacFile.c')
-rw-r--r-- | mac/tclMacFile.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c index 243127c..01c2678 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.19 2002/04/08 09:02:43 das Exp $ + * RCS: @(#) $Id: tclMacFile.c,v 1.20 2002/04/19 14:18:50 das Exp $ */ /* @@ -35,6 +35,8 @@ static int NativeMatchType(Tcl_Obj *tempName, Tcl_GlobTypeData *types, HFileInfo fileInfo, OSType okType, OSType okCreator); static OSErr FspLocationFromFsPath _ANSI_ARGS_((Tcl_Obj *pathPtr, FSSpec* specPtr)); +static OSErr FspLLocationFromFsPath _ANSI_ARGS_((Tcl_Obj *pathPtr, + FSSpec* specPtr)); static OSErr FspLocationFromFsPath(pathPtr, specPtr) @@ -45,6 +47,15 @@ FspLocationFromFsPath(pathPtr, specPtr) return FSpLocationFromPath(strlen(native), native, specPtr); } +static OSErr +FspLLocationFromFsPath(pathPtr, specPtr) + Tcl_Obj *pathPtr; + FSSpec* specPtr; +{ + CONST char *native = Tcl_FSGetNativePath(pathPtr); + return FSpLLocationFromPath(strlen(native), native, specPtr); +} + /* *---------------------------------------------------------------------- @@ -166,7 +177,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) return TCL_OK; } - if (FspLocationFromFsPath(fileNamePtr, &fileSpec) == noErr) { + if (FspLLocationFromFsPath(fileNamePtr, &fileSpec) == noErr) { paramBlock.hFileInfo.ioCompletion = NULL; paramBlock.hFileInfo.ioNamePtr = fileSpec.name; paramBlock.hFileInfo.ioVRefNum = fileSpec.vRefNum; @@ -438,7 +449,7 @@ TclpObjAccess(pathPtr, mode) long dirID; int full_mode = 0; - err = FspLocationFromFsPath(pathPtr, &fileSpec); + err = FspLLocationFromFsPath(pathPtr, &fileSpec); if (err != noErr) { errno = TclMacOSErrorToPosixError(err); @@ -761,6 +772,10 @@ TclpReadlink( return Tcl_DStringValue(linkPtr); } + +static int +TclpObjStatAlias _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *bufPtr, Boolean resolveLink)); + /* *---------------------------------------------------------------------- @@ -783,8 +798,7 @@ TclpObjLstat(pathPtr, buf) Tcl_Obj *pathPtr; Tcl_StatBuf *buf; { - /* This needs to be enhanced to deal with aliases */ - return TclpObjStat(pathPtr, buf); + return TclpObjStatAlias(pathPtr, buf, FALSE); } /* @@ -808,6 +822,13 @@ TclpObjStat(pathPtr, bufPtr) Tcl_Obj *pathPtr; Tcl_StatBuf *bufPtr; { + return TclpObjStatAlias(pathPtr, bufPtr, TRUE); +} + + +static int +TclpObjStatAlias (Tcl_Obj *pathPtr, Tcl_StatBuf *bufPtr, Boolean resolveLink) +{ HFileInfo fpb; HVolumeParam vpb; OSErr err; @@ -815,7 +836,10 @@ TclpObjStat(pathPtr, bufPtr) Boolean isDirectory; long dirID; - err = FspLocationFromFsPath(pathPtr, &fileSpec); + if (resolveLink) + err = FspLocationFromFsPath(pathPtr, &fileSpec); + else + err = FspLLocationFromFsPath(pathPtr, &fileSpec); if (err != noErr) { errno = TclMacOSErrorToPosixError(err); |