Skip to content

Commit 6c5b1c2

Browse files
committed
try with .native()
1 parent a706361 commit 6c5b1c2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/node_file.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ static void RmSync(const FunctionCallbackInfo<Value>& args) {
16871687
}
16881688

16891689
// On Windows path::c_str() returns wide char, convert to std::string first.
1690-
std::string file_path_str = file_path.string();
1690+
std::string file_path_str = file_path.native();
16911691
const char* path_c_str = file_path_str.c_str();
16921692
#ifdef _WIN32
16931693
int permission_denied_error = EPERM;
@@ -3180,7 +3180,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
31803180
// Check if src and dest are identical.
31813181
if (std::filesystem::equivalent(src_path, dest_path)) {
31823182
std::string message = "src and dest cannot be the same %s";
3183-
return THROW_ERR_FS_CP_EINVAL(env, message.c_str(), dest_path.string());
3183+
return THROW_ERR_FS_CP_EINVAL(env, message.c_str(), dest_path.native());
31843184
}
31853185

31863186
const bool dest_is_dir =
@@ -3190,19 +3190,19 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
31903190
std::string message =
31913191
"Cannot overwrite non-directory %s with directory %s";
31923192
return THROW_ERR_FS_CP_DIR_TO_NON_DIR(
3193-
env, message.c_str(), src_path.string(), dest_path.string());
3193+
env, message.c_str(), src_path.native(), dest_path.native());
31943194
}
31953195

31963196
if (!src_is_dir && dest_is_dir) {
31973197
std::string message =
31983198
"Cannot overwrite directory %s with non-directory %s";
31993199
return THROW_ERR_FS_CP_NON_DIR_TO_DIR(
3200-
env, message.c_str(), dest_path.string(), src_path.string());
3200+
env, message.c_str(), dest_path.native(), src_path.native());
32013201
}
32023202
}
32033203

3204-
std::string dest_path_str = dest_path.string();
3205-
std::string src_path_str = src_path.string();
3204+
std::string dest_path_str = dest_path.native();
3205+
std::string src_path_str = src_path.native();
32063206
if (!src_path_str.ends_with(std::filesystem::path::preferred_separator)) {
32073207
src_path_str += std::filesystem::path::preferred_separator;
32083208
}

0 commit comments

Comments
 (0)