Skip to content

Commit fed9c50

Browse files
fixup! fs: improve cpSync no-filter copyDir performance
actually fix the windows issue
1 parent a46afd0 commit fed9c50

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/node_file.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3588,11 +3588,11 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35883588
if (preserve_timestamps) {
35893589
uv_fs_t req;
35903590
auto cleanup = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); });
3591-
const char* dir_path = dir_entry.path().c_str();
35923591

3593-
int result = uv_fs_stat(nullptr, &req, dir_path, nullptr);
3592+
auto dir_entry_path = PathToString(dir_entry.path());
3593+
int result = uv_fs_stat(nullptr, &req, dir_entry_path.c_str(), nullptr);
35943594
if (is_uv_error(result)) {
3595-
env->ThrowUVException(result, "stat", nullptr, dir_path);
3595+
env->ThrowUVException(result, "stat", nullptr, dir_entry_path.c_str());
35963596
return false;
35973597
}
35983598

@@ -3602,11 +3602,11 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
36023602
const double source_mtime =
36033603
s->st_mtim.tv_sec + s->st_mtim.tv_nsec / 1e9;
36043604

3605-
const char* path = dest_entry_path.c_str();
3605+
auto path = PathToString(dir_entry.path());
36063606
int utime_result = uv_fs_utime(
3607-
nullptr, &req, path, source_atime, source_mtime, nullptr);
3607+
nullptr, &req, path.c_str(), source_atime, source_mtime, nullptr);
36083608
if (is_uv_error(utime_result)) {
3609-
env->ThrowUVException(utime_result, "utime", nullptr, path);
3609+
env->ThrowUVException(utime_result, "utime", nullptr, path.c_str());
36103610
return false;
36113611
}
36123612
}

0 commit comments

Comments
 (0)