summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2014-04-10 13:59:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2014-04-10 13:59:13 (GMT)
commitc21a540c4153d8738dadc191a3b2d6516990c108 (patch)
tree89e413cae334b617b7a719078df1d197859b04f3 /win/tclWinFile.c
parentda36dfe69e58aec61afac3c396af8cf6107b0ff1 (diff)
parentc5510a29171fa3a62f7a51af11bea2772bf10e3e (diff)
downloadtcl-c21a540c4153d8738dadc191a3b2d6516990c108.zip
tcl-c21a540c4153d8738dadc191a3b2d6516990c108.tar.gz
tcl-c21a540c4153d8738dadc191a3b2d6516990c108.tar.bz2
[792641f95b]: Normalized win32 paths should never contain backslash.
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index f69ad23..80d0915 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -2898,6 +2898,7 @@ TclNativeCreateNativeRep(
Tcl_DString ds;
Tcl_Obj *validPathPtr;
int len;
+ WCHAR *wp;
if (TclFSCwdIsNative()) {
/*
@@ -2923,17 +2924,14 @@ TclNativeCreateNativeRep(
}
str = Tcl_GetStringFromObj(validPathPtr, &len);
- if (str[0] == '/' && str[1] == '/' && str[2] == '?' && str[3] == '/') {
- char *p;
-
- for (p = str; p && *p; ++p) {
- if (*p == '/') {
- *p = '\\';
- }
- }
- }
Tcl_WinUtfToTChar(str, len, &ds);
len = Tcl_DStringLength(&ds) + sizeof(WCHAR);
+ wp = (WCHAR *) Tcl_DStringValue(&ds);
+ for (; *wp; ++wp) {
+ if (*wp=='/') {
+ *wp = '\\';
+ }
+ }
Tcl_DecrRefCount(validPathPtr);
nativePathPtr = ckalloc(len);
memcpy(nativePathPtr, Tcl_DStringValue(&ds), (size_t) len);