summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2011-10-10 11:31:26 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2011-10-10 11:31:26 (GMT)
commitcc6e9424f9a61dfbea0b6d097bd1d5f3d280df1e (patch)
tree6e6d5fd3240b77588485406ed77ae005563e664e /win
parent96e9e2115c6418078187b626c6368545e859ef7d (diff)
downloadtk-cc6e9424f9a61dfbea0b6d097bd1d5f3d280df1e.zip
tk-cc6e9424f9a61dfbea0b6d097bd1d5f3d280df1e.tar.gz
tk-cc6e9424f9a61dfbea0b6d097bd1d5f3d280df1e.tar.bz2
[BUG 3163893] -initialdir option bug for tk_chooseDirectory under XP
FossilOrigin-Name: 201af9ecc634509b51ab4736736263c5ffcbab79
Diffstat (limited to 'win')
-rw-r--r--win/tkWinDialog.c14
1 files changed, 7 insertions, 7 deletions
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;
}