diff options
author | vincentdarley <vincentdarley@noemail.net> | 2002-07-20 01:01:40 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley@noemail.net> | 2002-07-20 01:01:40 (GMT) |
commit | cc7df6806326b165c6cdae79f203885f15655d42 (patch) | |
tree | 6e6dd36efb02898a9ac963c730001573c6010733 /win/tclWinFile.c | |
parent | 2e74a8167da45e7d1f881cec1a3e994b182ac27a (diff) | |
download | tcl-cc7df6806326b165c6cdae79f203885f15655d42.zip tcl-cc7df6806326b165c6cdae79f203885f15655d42.tar.gz tcl-cc7df6806326b165c6cdae79f203885f15655d42.tar.bz2 |
vfs fixes
FossilOrigin-Name: 9e7220513241fca16eeedd8161a57e97868f395d
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r-- | win/tclWinFile.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 31dca87..04c5fa8 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.38 2002/07/19 12:31:10 dkf Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.39 2002/07/20 01:01:41 vincentdarley Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -452,19 +452,35 @@ WinReadLinkDirectory(LinkDirectory) case 0x80000000|IO_REPARSE_TAG_SYMBOLIC_LINK: case IO_REPARSE_TAG_SYMBOLIC_LINK: case IO_REPARSE_TAG_MOUNT_POINT: { - int len; - ClientData clientData; Tcl_Obj *retVal; + Tcl_DString ds; + CONST char *copy; + int len; - len = reparseBuffer->SymbolicLinkReparseBuffer.SubstituteNameLength - + sizeof(WCHAR); - clientData = (ClientData)ckalloc(len); - memcpy((VOID*)clientData, - (VOID*)reparseBuffer->SymbolicLinkReparseBuffer.PathBuffer, - len); - - retVal = Tcl_FSNewNativePath(&tclNativeFilesystem, clientData); + Tcl_WinTCharToUtf( + (CONST char*)reparseBuffer->SymbolicLinkReparseBuffer.PathBuffer, + (int)reparseBuffer->SymbolicLinkReparseBuffer.SubstituteNameLength, + &ds); + + copy = Tcl_DStringValue(&ds); + len = Tcl_DStringLength(&ds); + /* + * Certain native path representations on Windows have this special + * prefix to indicate that they are to be treated specially. For + * example extremely long paths, or symlinks + */ + if (*copy == '\\') { + if (0 == strncmp(copy,"\\??\\",4)) { + copy += 4; + len -= 4; + } else if (0 == strncmp(copy,"\\\\?\\",4)) { + copy += 4; + len -= 4; + } + } + retVal = Tcl_NewStringObj(copy,len); Tcl_IncrRefCount(retVal); + Tcl_DStringFree(&ds); return retVal; } } @@ -1362,7 +1378,7 @@ TclpReadlink(path, linkPtr) Tcl_DStringFree(&ds); if (length < 0) { - return NULL; + return NULL; } Tcl_ExternalToUtfDString(NULL, link, length, linkPtr); |