summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2002-06-13 10:43:41 (GMT)
committervincentdarley <vincentdarley>2002-06-13 10:43:41 (GMT)
commit92a76efd9325024fcfeaf1439aec2937afbf9130 (patch)
tree8ee2bfc73e3538dbf6e7c4b0f6f2287da771330e /win
parent3db3abd0e6cfd42d48f513b1b4e7640fbb47c7c6 (diff)
downloadtcl-92a76efd9325024fcfeaf1439aec2937afbf9130.zip
tcl-92a76efd9325024fcfeaf1439aec2937afbf9130.tar.gz
tcl-92a76efd9325024fcfeaf1439aec2937afbf9130.tar.bz2
fs normalize
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 6195c18..b12fb2a 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.31 2002/06/13 09:40:02 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.32 2002/06/13 10:43:41 vincentdarley Exp $
*/
//#define _WIN32_WINNT 0x0500
@@ -2166,6 +2166,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
lastValidPathEnd = currentPathEndPosition;
Tcl_DStringFree(&ds);
} else {
+ int isDrive = 1;
Tcl_DStringFree(&ds);
currentPathEndPosition = path + nextCheckpoint;
while (1) {
@@ -2187,7 +2188,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
* Check for symlinks, except at last component
* of path (we don't follow final symlinks)
*/
- if (cur != 0 && (data.dwFileAttributes
+ if (cur != 0 && !isDrive && (data.dwFileAttributes
& FILE_ATTRIBUTE_REPARSE_POINT)) {
Tcl_Obj *to = WinReadLinkDirectory(nativePath);
if (to != NULL) {
@@ -2218,6 +2219,11 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
if (cur == 0) {
break;
}
+ /*
+ * If we get here, we've got past one directory
+ * delimiter, so we know it is no longer a drive
+ */
+ isDrive = 0;
}
currentPathEndPosition++;
}
@@ -2249,8 +2255,11 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
if (ConvertFileNameFormat(interp, 0, tmpPathPtr, 1, &objPtr)
== TCL_OK) {
int len;
- (void) Tcl_GetStringFromObj(objPtr,&len);
+ CONST char* converted = Tcl_GetStringFromObj(objPtr,&len);
if (!endOfString) {
+ if (converted[len-1] == '/') {
+ lastValidPathEnd++;
+ }
/* Be nice and fix the string before we clear it */
Tcl_AppendToObj(objPtr, lastValidPathEnd, -1);
}