From 6c5b1c297f753b166020624135441abdf8f235cc Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 4 Oct 2024 16:32:22 +0200 Subject: [PATCH] try with `.native()` --- src/node_file.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 974a1f9f5b5702..db364290ce97e9 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1687,7 +1687,7 @@ static void RmSync(const FunctionCallbackInfo& args) { } // On Windows path::c_str() returns wide char, convert to std::string first. - std::string file_path_str = file_path.string(); + std::string file_path_str = file_path.native(); const char* path_c_str = file_path_str.c_str(); #ifdef _WIN32 int permission_denied_error = EPERM; @@ -3180,7 +3180,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { // Check if src and dest are identical. if (std::filesystem::equivalent(src_path, dest_path)) { std::string message = "src and dest cannot be the same %s"; - return THROW_ERR_FS_CP_EINVAL(env, message.c_str(), dest_path.string()); + return THROW_ERR_FS_CP_EINVAL(env, message.c_str(), dest_path.native()); } const bool dest_is_dir = @@ -3190,19 +3190,19 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { std::string message = "Cannot overwrite non-directory %s with directory %s"; return THROW_ERR_FS_CP_DIR_TO_NON_DIR( - env, message.c_str(), src_path.string(), dest_path.string()); + env, message.c_str(), src_path.native(), dest_path.native()); } if (!src_is_dir && dest_is_dir) { std::string message = "Cannot overwrite directory %s with non-directory %s"; return THROW_ERR_FS_CP_NON_DIR_TO_DIR( - env, message.c_str(), dest_path.string(), src_path.string()); + env, message.c_str(), dest_path.native(), src_path.native()); } } - std::string dest_path_str = dest_path.string(); - std::string src_path_str = src_path.string(); + std::string dest_path_str = dest_path.native(); + std::string src_path_str = src_path.native(); if (!src_path_str.ends_with(std::filesystem::path::preferred_separator)) { src_path_str += std::filesystem::path::preferred_separator; }