summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2024-09-18 18:36:45 (GMT)
committerdgp <dgp@users.sourceforge.net>2024-09-18 18:36:45 (GMT)
commit5a9ab2deb005762c56b44b74b0ca7b4d76cd3dec (patch)
treebe8979ebe5eba6a2e07cad549d702dd22dc14cd3 /win
parenta3e8589a96875b491acd1c7ef19c4c86c151f357 (diff)
parent95506b335839aec444017ea62f586343bbb15398 (diff)
downloadtcl-5a9ab2deb005762c56b44b74b0ca7b4d76cd3dec.zip
tcl-5a9ab2deb005762c56b44b74b0ca7b4d76cd3dec.tar.gz
tcl-5a9ab2deb005762c56b44b74b0ca7b4d76cd3dec.tar.bz2
merge trunk
Diffstat (limited to 'win')
-rw-r--r--win/tclWinChan.c18
-rw-r--r--win/tclWinFile.c4
2 files changed, 20 insertions, 2 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index b81af7e..eb41706 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -11,6 +11,7 @@
*/
#include "tclWinInt.h"
+#include "tclFileSystem.h"
#include "tclIO.h"
/*
@@ -996,6 +997,23 @@ TclpOpenFileChannel(
nativeName = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (nativeName == NULL) {
if (interp) {
+ /*
+ * We need this just to ensure we return the correct error messages under
+ * some circumstances (relative paths only), so because the normalization
+ * is very expensive, don't invoke it for native or absolute paths.
+ * Note: since paths starting with ~ are relative in 9.0 for windows,
+ * it doesn't need to consider tilde expansion (in opposite to 8.x).
+ */
+ if (
+ (
+ !TclFSCwdIsNative() &&
+ (Tcl_FSGetPathType(pathPtr) != TCL_PATH_ABSOLUTE)
+ ) &&
+ Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL
+ ) {
+ return NULL;
+ }
+
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't open \"%s\": filename is invalid on this platform",
TclGetString(pathPtr)));
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 03c92e2..74ffc47 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -3023,9 +3023,9 @@ TclNativeCreateNativeRep(
Tcl_Size len;
WCHAR *wp;
- if (TclFSCwdIsNative()) {
+ if (TclFSCwdIsNative() || Tcl_FSGetPathType(pathPtr) == TCL_PATH_ABSOLUTE) {
/*
- * The cwd is native, which means we can use the translated path
+ * 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).
*/