summaryrefslogtreecommitdiffstats
path: root/win/tkWinDialog.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2011-10-10 11:31:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2011-10-10 11:31:26 (GMT)
commit351e69ec020aae77619cd10fea873347cf2b731c (patch)
tree6e6d5fd3240b77588485406ed77ae005563e664e /win/tkWinDialog.c
parentfd25c934b3f6aa904ada48fa8929492ec0daa269 (diff)
downloadtk-351e69ec020aae77619cd10fea873347cf2b731c.zip
tk-351e69ec020aae77619cd10fea873347cf2b731c.tar.gz
tk-351e69ec020aae77619cd10fea873347cf2b731c.tar.bz2
[BUG 3163893] -initialdir option bug for tk_chooseDirectory under XP
Diffstat (limited to 'win/tkWinDialog.c')
-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;
}