summaryrefslogtreecommitdiffstats
path: root/generic/tclIOUtil.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIOUtil.c')
-rw-r--r--generic/tclIOUtil.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 41e218f..00a0359 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -190,6 +190,8 @@ const Tcl_Filesystem tclNativeFilesystem = {
TclpObjChdir
};
+MODULE_SCOPE Tcl_Filesystem zipfsFilesystem;
+
/*
* Define the tail of the linked list. Note that for unconventional uses of
* Tcl without a native filesystem, we may in the future wish to modify the
@@ -1410,6 +1412,22 @@ TclFSNormalizeToUniquePath(
Claim();
for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) {
+ if (fsRecPtr->fsPtr == &zipfsFilesystem) {
+ ClientData clientData = NULL;
+ /*
+ * Allow mounted zipfs filesystem to overtake entire normalisation.
+ * This is needed on unix for mounts on symlinks right below root.
+ */
+
+ if (fsRecPtr->fsPtr->pathInFilesystemProc != NULL) {
+ if (fsRecPtr->fsPtr->pathInFilesystemProc(pathPtr,
+ &clientData)!=-1) {
+ TclFSSetPathDetails(pathPtr, fsRecPtr->fsPtr, clientData);
+ break;
+ }
+ }
+ continue;
+ }
if (fsRecPtr->fsPtr != &tclNativeFilesystem) {
continue;
}
@@ -1434,6 +1452,9 @@ TclFSNormalizeToUniquePath(
if (fsRecPtr->fsPtr == &tclNativeFilesystem) {
continue;
}
+ if (fsRecPtr->fsPtr == &zipfsFilesystem) {
+ continue;
+ }
if (fsRecPtr->fsPtr->normalizePathProc != NULL) {
startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr,
@@ -2914,6 +2935,19 @@ Tcl_FSChdir(
}
fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+
+ if ((fsPtr != NULL) && (fsPtr != &tclNativeFilesystem)) {
+ /*
+ * Watch out for tilde substitution.
+ * Only valid in native filesystem.
+ */
+ char *name = Tcl_GetString(pathPtr);
+
+ if ((name != NULL) && (*name == '~')) {
+ fsPtr = &tclNativeFilesystem;
+ }
+ }
+
if (fsPtr != NULL) {
if (fsPtr->chdirProc != NULL) {
/*