diff --git a/intern/utfconv/CMakeLists.txt b/intern/utfconv/CMakeLists.txt index 0f567f13a7c..bac762af27b 100644 --- a/intern/utfconv/CMakeLists.txt +++ b/intern/utfconv/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later set(INC - . + PUBLIC . ) set(INC_SYS @@ -30,3 +30,4 @@ if(WIN32) endif() blender_add_lib(bf_intern_utfconv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") +add_library(bf::intern::utfconv ALIAS bf_intern_utfconv) diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index 81ca6866837..c645f5f6abc 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -55,6 +55,9 @@ set(LIB if(WIN32) add_definitions(-DNOMINMAX) + list(APPEND LIB + PRIVATE bf::intern::utfconv + ) endif() if(WITH_HEADLESS) diff --git a/source/blender/editors/space_file/fsmenu_system.cc b/source/blender/editors/space_file/fsmenu_system.cc index a2b79f3e56b..3be31c4ccee 100644 --- a/source/blender/editors/space_file/fsmenu_system.cc +++ b/source/blender/editors/space_file/fsmenu_system.cc @@ -27,7 +27,7 @@ #include "ED_fileselect.hh" #ifdef WIN32 -# include "BLI_string_utf8.h" /* For `BLI_strncpy_wchar_as_utf8`. */ +# include "utfconv.hh" /* Need to include windows.h so _WIN32_IE is defined. */ # include @@ -211,7 +211,7 @@ static void fsmenu_add_windows_quick_access(FSMenu *fsmenu, } char utf_path[FILE_MAXDIR]; - BLI_strncpy_wchar_as_utf8(utf_path, path, FILE_MAXDIR); + conv_utf_16_to_8(path, utf_path, FILE_MAXDIR); /* Skip library folders since they are not currently supported. */ if (!BLI_strcasestr(utf_path, ".library-ms")) { @@ -232,7 +232,7 @@ static void fsmenu_add_windows_folder(FSMenu *fsmenu, LPWSTR pPath; char line[FILE_MAXDIR]; if (SHGetKnownFolderPath(rfid, 0, nullptr, &pPath) == S_OK) { - BLI_strncpy_wchar_as_utf8(line, pPath, FILE_MAXDIR); + conv_utf_16_to_8(pPath, line, FILE_MAXDIR); fsmenu_insert_entry(fsmenu, category, line, name, icon, flag); } CoTaskMemFree(pPath); @@ -262,7 +262,7 @@ void fsmenu_read_system(FSMenu *fsmenu, int read_bookmarks) /* Skip over floppy disks A & B. */ if (i > 1) { /* Friendly volume descriptions without using SHGetFileInfoW (#85689). */ - BLI_strncpy_wchar_from_utf8(wline, tmps, 4); + conv_utf_8_to_16(tmps, wline, 4); IShellFolder *desktop; if (SHGetDesktopFolder(&desktop) == S_OK) { PIDLIST_RELATIVE volume; @@ -274,7 +274,7 @@ void fsmenu_read_system(FSMenu *fsmenu, int read_bookmarks) if (desktop->GetDisplayNameOf(volume, SHGDN_FORADDRESSBAR, &volume_name) == S_OK) { wchar_t *volume_name_wchar; if (StrRetToStrW(&volume_name, volume, &volume_name_wchar) == S_OK) { - BLI_strncpy_wchar_as_utf8(line, volume_name_wchar, FILE_MAXDIR); + conv_utf_16_to_8(volume_name_wchar, line, FILE_MAXDIR); name = line; CoTaskMemFree(volume_name_wchar); }