From 98e3694c39f3dde7a9d01b82ea627e55fa5eda8f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 26 Feb 2015 11:21:21 +0100 Subject: [PATCH] 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... --- source/blender/editors/space_file/fsmenu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 6b4ee318633..c6ee6875403 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); } }