summaryrefslogtreecommitdiffstats
path: root/generic/tclIOUtil.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2002-06-10 10:41:29 (GMT)
committervincentdarley <vincentdarley>2002-06-10 10:41:29 (GMT)
commite41988bdf21c8f8cd4088031e67e4fdd1793b7b7 (patch)
tree52f8f5eeb7341010a5adc4347582bada8c1d8f6a /generic/tclIOUtil.c
parent08219eb4280580b6c067ff3217add41b065014a6 (diff)
downloadtcl-e41988bdf21c8f8cd4088031e67e4fdd1793b7b7.zip
tcl-e41988bdf21c8f8cd4088031e67e4fdd1793b7b7.tar.gz
tcl-e41988bdf21c8f8cd4088031e67e4fdd1793b7b7.tar.bz2
small fs fixes
Diffstat (limited to 'generic/tclIOUtil.c')
-rw-r--r--generic/tclIOUtil.c54
1 files changed, 43 insertions, 11 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index e59f244..c44687b 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.45 2002/05/28 15:05:22 vincentdarley Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.46 2002/06/10 10:41:29 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -25,6 +25,10 @@
#ifdef MAC_TCL
#include "tclMacInt.h"
#endif
+#ifdef __WIN32__
+/* For 'file link' */
+#include "tclWinInt.h"
+#endif
/*
* Prototypes for procedures defined later in this file.
@@ -4417,13 +4421,31 @@ TclpNativeToNormalized(clientData)
{
Tcl_DString ds;
Tcl_Obj *objPtr;
+ CONST char *copy;
+ int len;
#ifdef __WIN32__
Tcl_WinTCharToUtf((CONST char*)clientData, -1, &ds);
#else
Tcl_ExternalToUtfDString(NULL, (CONST char*)clientData, -1, &ds);
#endif
- objPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),Tcl_DStringLength(&ds));
+
+ copy = Tcl_DStringValue(&ds);
+ len = Tcl_DStringLength(&ds);
+
+#ifdef __WIN32__
+ /*
+ * 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 (0 == strncmp(copy,"\\??\\",4)) {
+ copy += 4;
+ len -= 4;
+ }
+#endif
+
+ objPtr = Tcl_NewStringObj(copy,len);
Tcl_DStringFree(&ds);
return objPtr;
@@ -4450,19 +4472,29 @@ static ClientData
NativeDupInternalRep(clientData)
ClientData clientData;
{
-#ifdef __WIN32__
- /* Copying internal representations is complicated with multi-byte TChars */
- return NULL;
-#else
+ ClientData copy;
+ size_t len;
+
if (clientData == NULL) {
- return NULL;
+ return NULL;
+ }
+
+#ifdef __WIN32__
+ if (tclWinProcs->useWide) {
+ /* unicode representation when running on NT/2K/XP */
+ len = sizeof(WCHAR) + (wcslen((CONST WCHAR*)clientData) * sizeof(WCHAR));
} else {
- char *native = (char*)clientData;
- char *copy = ckalloc((unsigned)(1+strlen(native)));
- strcpy(copy,native);
- return (ClientData)copy;
+ /* ansi representation when running on 95/98/ME */
+ len = sizeof(CHAR) + (strlen((CONST CHAR*)clientData) * sizeof(CHAR));
}
+#else
+ /* ansi representation when running on Unix/MacOS */
+ len = sizeof(CHAR) + (strlen((CONST CHAR*)clientData) * sizeof(CHAR));
#endif
+
+ copy = (ClientData) ckalloc(len);
+ memcpy((VOID*)copy, (VOID*)clientData, len);
+ return copy;
}
/*