From 906c3058eab5d871756de4de703f2d75d7363574 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 17 Sep 2024 15:17:44 +0000 Subject: fixes further normalization bottleneck of 8.7+ [02d5d65d70adab97], guess [411f52ed87e313dd49e2] too (zipfs now) --- generic/tclZipfs.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index ee280ee..d8ac050 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -5858,9 +5858,26 @@ ZipFSPathInFilesystemProc( Tcl_Size len; char *path; - pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr); - if (!pathPtr) { - return -1; + if (TclFSCwdIsNative() || Tcl_FSGetPathType(pathPtr) == TCL_PATH_ABSOLUTE) { + /* + * The cwd is native (or path is absolute), use the translated path + * without worrying about normalization (this will also usually be + * shorter so the utf-to-external conversion will be somewhat faster). + */ + + pathPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr); + if (pathPtr == NULL) { + return -1; + } + } else { + /* + * Make sure the normalized path is set. + */ + + pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr); + if (!pathPtr) { + return -1; + } } path = TclGetStringFromObj(pathPtr, &len); -- cgit v0.12