From 3a6536ce543e8a38cbc971b067986a4d5bdb2f89 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 21 Oct 2024 03:38:25 -0700 Subject: [PATCH] [New+]Fix for bug when creating folders or files rhat contain Unicode characters (#35465) wstring all the way --- .../NewShellExtensionContextMenu/template_item.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/NewPlus/NewShellExtensionContextMenu/template_item.cpp b/src/modules/NewPlus/NewShellExtensionContextMenu/template_item.cpp index 3c863be18e..e644df5c85 100644 --- a/src/modules/NewPlus/NewShellExtensionContextMenu/template_item.cpp +++ b/src/modules/NewPlus/NewShellExtensionContextMenu/template_item.cpp @@ -67,12 +67,12 @@ std::filesystem::path template_item::copy_object_to(const HWND window_handle, co { // SHFILEOPSTRUCT wants the from and to paths to be terminated with two NULLs, wchar_t double_terminated_path_from[MAX_PATH + 1] = { 0 }; - wcsncpy_s(double_terminated_path_from, this->path.c_str(), this->path.string().length()); - double_terminated_path_from[this->path.string().length() + 1] = 0; + wcsncpy_s(double_terminated_path_from, this->path.c_str(), this->path.wstring().length()); + double_terminated_path_from[this->path.wstring().length() + 1] = 0; wchar_t double_terminated_path_to[MAX_PATH + 1] = { 0 }; - wcsncpy_s(double_terminated_path_to, destination.c_str(), destination.string().length()); - double_terminated_path_to[destination.string().length() + 1] = 0; + wcsncpy_s(double_terminated_path_to, destination.c_str(), destination.wstring().length()); + double_terminated_path_to[destination.wstring().length() + 1] = 0; SHFILEOPSTRUCT file_operation_params = { 0 }; file_operation_params.wFunc = FO_COPY;