Tk Source Code

Artifact [a82b15bb]
Login

Artifact a82b15bb5cf4653cf15d94bd401d6ffe70f11838:

Attachment "uni-choosedir-1913750.patch" to ticket [1913750f] added by hobbs 2009-03-26 05:50:55.
Index: win/tkWinDialog.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/win/tkWinDialog.c,v
retrieving revision 1.50.2.1
diff -u -r1.50.2.1 tkWinDialog.c
--- win/tkWinDialog.c	14 Apr 2008 20:59:51 -0000	1.50.2.1
+++ win/tkWinDialog.c	25 Mar 2009 22:48:28 -0000
@@ -1689,6 +1689,7 @@
     TCHAR saveDir[MAX_PATH];
     Tcl_DString titleString;	/* UTF Title */
     Tcl_DString initDirString;	/* Initial directory */
+    Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
     static CONST char *optionStrings[] = {
 	"-initialdir", "-mustexist",  "-parent",  "-title", NULL
     };
@@ -1823,13 +1824,13 @@
 	 */
 
 	if (pidl != NULL) {
-	    if (!SHGetPathFromIDList(pidl, path)) {
+	    if (!SHGetPathFromIDListW(pidl, path)) {
 		Tcl_SetResult(interp, "Error: Not a file system folder\n",
 			TCL_VOLATILE);
 	    };
 	    pMalloc->lpVtbl->Free(pMalloc, (void *) pidl);
-	} else if (lstrlen(cdCBData.utfRetDir) > 0) {
-	    lstrcpy(path, cdCBData.utfRetDir);
+	} else if (lstrlenW(cdCBData.utfRetDir) > 0) {
+	    lstrcpyW(path, cdCBData.utfRetDir);
 	}
 	pMalloc->lpVtbl->Release(pMalloc);
     }
@@ -1853,7 +1854,7 @@
     if (*path) {
 	Tcl_DString ds;
 
-	Tcl_AppendResult(interp, ConvertExternalFilename(NULL, (char *) path,
+	Tcl_AppendResult(interp, ConvertExternalFilename(unicodeEncoding, (char *) path,
 		&ds), NULL);
 	Tcl_DStringFree(&ds);
     }
@@ -1971,11 +1972,11 @@
 	 * Not called when user changes edit box directly.
 	 */
 
-	if (SHGetPathFromIDList((LPITEMIDLIST) lParam, selDir)) {
+	if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) {
 	    SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir);
 	    // enable the OK button
 	    SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
-	    SetCurrentDirectory(selDir);
+	    SetCurrentDirectoryW(selDir);
 	} else {
 	    // disable the OK button
 	    SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);