[Bf-blender-cvs] [98e3694] master: Fix T43817: issue with non-utf8 encodings in Windows paths, again...

Bastien Montagne noreply at git.blender.org
Thu Feb 26 11:28:15 CET 2015


Commit: 98e3694c39f3dde7a9d01b82ea627e55fa5eda8f
Author: Bastien Montagne
Date:   Thu Feb 26 11:21:21 2015 +0100
Branches: master
https://developer.blender.org/rB98e3694c39f3dde7a9d01b82ea627e55fa5eda8f

Fix T43817: issue with non-utf8 encodings in Windows paths, again...

We need to use 'W' widechar variants of win funcs and convert wchar to utf8-encoded bytes
in those cases, sigh...

Note: theoritical fix only, need org reporter to test it...

===================================================================

M	source/blender/editors/space_file/fsmenu.c

===================================================================

diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 6b4ee31..c6ee687 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -437,6 +437,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 #ifdef WIN32
 	/* Add the drive names to the listing */
 	{
+		wchar_t wline[FILE_MAXDIR];
 		__int64 tmp;
 		char tmps[4];
 		int i;
@@ -456,9 +457,11 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 
 		/* Adding Desktop and My Documents */
 		if (read_bookmarks) {
-			SHGetSpecialFolderPath(0, line, CSIDL_PERSONAL, 0);
+			SHGetSpecialFolderPathW(0, wline, CSIDL_PERSONAL, 0);
+			BLI_strncpy_wchar_as_utf8(line, wline, FILE_MAXDIR);
 			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL, FS_INSERT_SORTED);
-			SHGetSpecialFolderPath(0, line, CSIDL_DESKTOPDIRECTORY, 0);
+			SHGetSpecialFolderPathW(0, wline, CSIDL_DESKTOPDIRECTORY, 0);
+			BLI_strncpy_wchar_as_utf8(line, wline, FILE_MAXDIR);
 			fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL, FS_INSERT_SORTED);
 		}
 	}




More information about the Bf-blender-cvs mailing list