summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--win/tkWinDialog.c14
2 files changed, 13 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index cf32948..d0cdac6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
+2011-10-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [BUG 3163893] -initialdir option bug for
+ tk_chooseDirectory under XP
+
2011-10-05 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinInt.h: Remove tclWinProcs, as it is no longer
+ * win/tkWinInt.h: Remove tkWinProcs, as it is no longer
* win/tkWinX.c: being used.
* win/tkWinTest.c:
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 6940f1b..51d918f 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1649,7 +1649,10 @@ ChooseDirectoryValidateProc(
char *initDir = chooseDirSharedData->utfInitDir;
- SetCurrentDirectoryA(initDir);
+ Tcl_DString initDirDStr;
+ Tcl_UtfToExternalDString(TkWinGetUnicodeEncoding(), initDir, -1, &initDirDStr);
+ SetCurrentDirectoryA(Tcl_DStringValue(&initDirDStr));
+
if (*initDir == '\\') {
/*
* BFFM_SETSELECTION only understands UNC paths as pidls, so
@@ -1663,26 +1666,23 @@ ChooseDirectoryValidateProc(
if (SUCCEEDED(SHGetDesktopFolder(&psfFolder))) {
LPITEMIDLIST pidlMain;
ULONG ulCount, ulAttr;
- Tcl_DString ds;
- Tcl_UtfToExternalDString(TkWinGetUnicodeEncoding(),
- initDir, -1, &ds);
if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName(
psfFolder, hwnd, NULL, (WCHAR *)
- Tcl_DStringValue(&ds), &ulCount,&pidlMain,&ulAttr))
+ Tcl_DStringValue(&initDirDStr), &ulCount,&pidlMain,&ulAttr))
&& (pidlMain != NULL)) {
SendMessageA(hwnd, BFFM_SETSELECTION, FALSE,
(LPARAM) pidlMain);
pMalloc->lpVtbl->Free(pMalloc, pidlMain);
}
psfFolder->lpVtbl->Release(psfFolder);
- Tcl_DStringFree(&ds);
}
pMalloc->lpVtbl->Release(pMalloc);
}
} else {
- SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) initDir);
+ SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) Tcl_DStringValue(&initDirDStr));
}
+ Tcl_DStringFree(&initDirDStr);
SendMessageA(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
break;
}