Fix for T75595: File Browser and Windows Unicode Paths

Fix for incorrect conversion to utf16 in BLI_file_attributes().

Differential Revision: https://developer.blender.org/D7398

Reviewed by Brecht Van Lommel
This commit is contained in:
Harley Acheson 2020-04-10 14:07:15 -07:00
parent 4f9a56cbc4
commit a8d139ca20
Notes: blender-bot 2023-02-14 04:07:50 +01:00
Referenced by issue #81211, Fast circular strokes by Paint and Sculpt brushes using mouse are angular.
Referenced by issue #75631, New multires shrinkage problem
Referenced by issue #75276, Increasing density in volume shader causes strange artifacts on smoke
1 changed files with 3 additions and 2 deletions

View File

@ -232,8 +232,9 @@ eFileAttributes BLI_file_attributes(const char *path)
int ret = 0;
# ifdef WIN32
wchar_t wline[FILE_MAXDIR];
BLI_strncpy_wchar_from_utf8(wline, path, ARRAY_SIZE(wline));
WCHAR wline[FILE_MAXDIR];
size_t bsize = count_utf_16_from_8(path);
conv_utf_8_to_16(path, wline, bsize);
DWORD attr = GetFileAttributesW(wline);
if (attr & FILE_ATTRIBUTE_READONLY) {
ret |= FILE_ATTR_READONLY;