Skip to content

Commit 3a0d042

Browse files
(try to) fix windows paths issue
1 parent 102ab4d commit 3a0d042

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/node_file.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,10 +3512,12 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35123512
std::filesystem::path dest) {
35133513
std::error_code error;
35143514
for (auto dir_entry : std::filesystem::directory_iterator(src)) {
3515+
auto dir_entry_path_str = PathToString(dir_entry.path());
35153516
auto dest_file_path = dest / dir_entry.path().filename();
3517+
auto dest_file_path_str = PathToString(dest_file_path);
35163518

35173519
if (filter_fn &&
3518-
!(*filter_fn)(dir_entry.path().c_str(), dest_file_path.c_str())) {
3520+
!(*filter_fn)(dir_entry_path_str.c_str(), dest_file_path_str.c_str())) {
35193521
continue;
35203522
}
35213523

@@ -3582,7 +3584,6 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35823584
}
35833585
} else if (std::filesystem::is_regular_file(dest_file_path)) {
35843586
if (!dereference || (!force && error_on_exist)) {
3585-
auto dest_file_path_str = PathToString(dest_file_path);
35863587
env->ThrowStdErrException(
35873588
std::make_error_code(std::errc::file_exists),
35883589
"cp",

0 commit comments

Comments
 (0)