Skip to content

Commit 5cb540a

Browse files
fixup! fs: improve cpSync no-filter copyDir performance
try to fix windows issue
1 parent 7e0a60c commit 5cb540a

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/node_file.cc

Lines changed: 8 additions & 13 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-
int result =
3592-
uv_fs_stat(nullptr, &req, dir_entry.path().c_str(), nullptr);
3591+
const char* dir_path = dir_entry.path().c_str();
3592+
3593+
int result = uv_fs_stat(nullptr, &req, dir_path, nullptr);
35933594
if (is_uv_error(result)) {
3594-
env->ThrowUVException(
3595-
result, "stat", nullptr, dir_entry.path().c_str());
3595+
env->ThrowUVException(result, "stat", nullptr, dir_path);
35963596
return false;
35973597
}
35983598

@@ -3602,16 +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* dest_path = dest_entry_path.c_str();
3606-
int utime_result = uv_fs_utime(nullptr,
3607-
&req,
3608-
dest_path,
3609-
source_atime,
3610-
source_mtime,
3611-
nullptr);
3605+
const char* path = dest_entry_path.c_str();
3606+
int utime_result = uv_fs_utime(
3607+
nullptr, &req, path, source_atime, source_mtime, nullptr);
36123608
if (is_uv_error(utime_result)) {
3613-
env->ThrowUVException(
3614-
utime_result, "utime", nullptr, dest_entry_path.c_str());
3609+
env->ThrowUVException(utime_result, "utime", nullptr, path);
36153610
return false;
36163611
}
36173612
}

0 commit comments

Comments
 (0)