From e6b1227197ceae9a613a6b8e0866e592407bff97 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 14 Nov 2012 13:46:14 +0000 Subject: Bug 3500545: tk_getOpenFile -multiple 1 wrong on windows --- ChangeLog | 5 +++++ win/tkWinDialog.c | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec4e237..553a95a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-11-14 Jan Nijtmans + + * win/tkWinDialog.c: [Bug 3500545]: tk_getOpenFile -multiple 1 wrong + on windows + 2012-11-11 Jan Nijtmans * win/tkWinTest.c: [Bug 3585396]: winDialog.test requires user diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 9263830..3663807 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -1034,14 +1034,24 @@ OFNHookProc( } *tmp = '\0'; /* Second NULL terminator. */ } else { - buffer[selsize] = '\0'; /* Second NULL terminator. */ - /* - * Replace directory terminating NULL with a backslash. + /* + * Replace directory terminating NULL with a with a backslash, + * but only if not an absolute path. */ - buffer--; - *buffer = '\\'; + Tcl_DString tmpfile; + ConvertExternalFilename(buffer, &tmpfile); + if (TCL_PATH_ABSOLUTE == + Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) { + /* re-get the full path to the start of the buffer */ + buffer = (TCHAR *) ofnData->dynFileBuffer; + SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); + } else { + *(buffer-1) = '\\'; + } + buffer[selsize] = '\0'; /* Second NULL terminator. */ + Tcl_DStringFree(&tmpfile); } } else { /* -- cgit v0.12