Tcl Source Code

Check-in [96abaae1f9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Purge the old, buggy implementation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-3414754
Files: files | file ages | folders
SHA1: 96abaae1f95e28845297c022b1b4e28bfa88ef56
User & Date: dgp 2011-10-31 17:04:31
Context
2011-10-31
17:06
3414754 Fix the PATHFLAGS != 0 intrep normalizing trailing slashes. check-in: 594e384786 user: dgp tags: core-8-5-branch
17:04
Purge the old, buggy implementation. Closed-Leaf check-in: 96abaae1f9 user: dgp tags: bug-3414754
2011-10-27
21:16
CONST-ification update. check-in: 1df7c85892 user: dgp tags: bug-3414754
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclPathObj.c.

1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
    Tcl_Obj *head,
    Tcl_Obj *tail)
{
    int numBytes;
    const char *bytes;
    Tcl_Obj *copy = Tcl_DuplicateObj(head);

#if 1
    /*
     * This is likely buggy when dealing with virtual filesystem drivers
     * that use some character other than "/" as a path separator.  I know
     * of no evidence that such a foolish thing exists.  This solution was
     * chosen so that "JoinPath" operations that pass through either path
     * intrep produce the same results; that is, bugward compatibility.  If
     * we need to fix that bug here, it needs fixing in Tcl_FSJoinPath() too.
     */
    bytes = Tcl_GetStringFromObj(tail, &numBytes);
    if (numBytes == 0) {
	Tcl_AppendToObj(copy, "/", 1);
    } else {
	TclpNativeJoinPath(copy, bytes);
    }
#else
    bytes = Tcl_GetStringFromObj(copy, &numBytes);

    /*
     * Should we perhaps use 'Tcl_FSPathSeparator'? But then what about the
     * Windows special case? Perhaps we should just check if cwd is a root
     * volume. We should never get numBytes == 0 in this code path.
     */

    switch (tclPlatform) {
    case TCL_PLATFORM_UNIX:
	if (bytes[numBytes-1] != '/') {
	    Tcl_AppendToObj(copy, "/", 1);
	}
	break;

    case TCL_PLATFORM_WINDOWS:
	/*
	 * We need the extra 'numBytes != 2', and ':' checks because a volume
	 * relative path doesn't get a '/'. For example 'glob C:*cat*.exe'
	 * will return 'C:cat32.exe'
	 */

	if (bytes[numBytes-1] != '/' && bytes[numBytes-1] != '\\') {
	    if (numBytes!= 2 || bytes[1] != ':') {
		Tcl_AppendToObj(copy, "/", 1);
	    }
	}
	break;
    }

    Tcl_AppendObjToObj(copy, tail);
#endif
    return copy;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclFSMakePathRelative --







<














<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1363
1364
1365
1366
1367
1368
1369

1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383

































1384
1385
1386
1387
1388
1389
1390
    Tcl_Obj *head,
    Tcl_Obj *tail)
{
    int numBytes;
    const char *bytes;
    Tcl_Obj *copy = Tcl_DuplicateObj(head);


    /*
     * This is likely buggy when dealing with virtual filesystem drivers
     * that use some character other than "/" as a path separator.  I know
     * of no evidence that such a foolish thing exists.  This solution was
     * chosen so that "JoinPath" operations that pass through either path
     * intrep produce the same results; that is, bugward compatibility.  If
     * we need to fix that bug here, it needs fixing in Tcl_FSJoinPath() too.
     */
    bytes = Tcl_GetStringFromObj(tail, &numBytes);
    if (numBytes == 0) {
	Tcl_AppendToObj(copy, "/", 1);
    } else {
	TclpNativeJoinPath(copy, bytes);
    }

































    return copy;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclFSMakePathRelative --