13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 2001-2004 Vincent Darley.
*
* 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.81.2.33 2007/11/12 20:40:45 dgp Exp $
*/
#include "tclInt.h"
#ifdef __WIN32__
# include "tclWinInt.h"
#endif
#include "tclFileSystem.h"
|
|
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 2001-2004 Vincent Darley.
*
* 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.81.2.34 2007/12/18 04:18:26 dgp Exp $
*/
#include "tclInt.h"
#ifdef __WIN32__
# include "tclWinInt.h"
#endif
#include "tclFileSystem.h"
|
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
|
Tcl_ListObjReplace(NULL, resultPtr, j, 1, 0, NULL);
gLength--;
}
break; /* Break out of for loop */
}
}
if (!found && dir) {
int len, mlen;
const char *path;
const char *mount;
Tcl_Obj *norm;
/*
* We know mElt is absolute normalized and lies inside pathPtr, so
* now we must add to the result the right representation of mElt,
* i.e. the representation which is relative to pathPtr.
*/
mount = Tcl_GetStringFromObj(mElt, &mlen);
norm = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (norm != NULL) {
path = Tcl_GetStringFromObj(norm, &len);
if (path[len-1] == '/') {
/*
* Deal with the root of the volume.
*/
len--;
}
mElt = TclNewFSPathObj(pathPtr, mount + len + 1, mlen - len);
Tcl_ListObjAppendElement(NULL, resultPtr, mElt);
}
/*
* No need to increment gLength, since we don't want to compare
* mounts against mounts.
*/
}
|
<
<
<
>
<
>
>
>
>
|
|
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
|
Tcl_ListObjReplace(NULL, resultPtr, j, 1, 0, NULL);
gLength--;
}
break; /* Break out of for loop */
}
}
if (!found && dir) {
Tcl_Obj *norm;
int len, mlen;
/*
* We know mElt is absolute normalized and lies inside pathPtr, so
* now we must add to the result the right representation of mElt,
* i.e. the representation which is relative to pathPtr.
*/
norm = Tcl_FSGetNormalizedPath(NULL, pathPtr);
if (norm != NULL) {
const char *path, *mount;
mount = Tcl_GetStringFromObj(mElt, &mlen);
path = Tcl_GetStringFromObj(norm, &len);
if (path[len-1] == '/') {
/*
* Deal with the root of the volume.
*/
len--;
}
len++; /* account for '/' in the mElt [Bug 1602539] */
mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len);
Tcl_ListObjAppendElement(NULL, resultPtr, mElt);
}
/*
* No need to increment gLength, since we don't want to compare
* mounts against mounts.
*/
}
|