Skip to content

Commit 9b4154d

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

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/node_file.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3588,11 +3588,13 @@ 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();
3592+
35913593
int result =
3592-
uv_fs_stat(nullptr, &req, dir_entry.path().c_str(), nullptr);
3594+
uv_fs_stat(nullptr, &req, dir_path, nullptr);
35933595
if (is_uv_error(result)) {
35943596
env->ThrowUVException(
3595-
result, "stat", nullptr, dir_entry.path().c_str());
3597+
result, "stat", nullptr, dir_path);
35963598
return false;
35973599
}
35983600

@@ -3602,16 +3604,16 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
36023604
const double source_mtime =
36033605
s->st_mtim.tv_sec + s->st_mtim.tv_nsec / 1e9;
36043606

3605-
const char* dest_path = dest_entry_path.c_str();
3607+
const char* path = dest_entry_path.c_str();
36063608
int utime_result = uv_fs_utime(nullptr,
36073609
&req,
3608-
dest_path,
3610+
path,
36093611
source_atime,
36103612
source_mtime,
36113613
nullptr);
36123614
if (is_uv_error(utime_result)) {
36133615
env->ThrowUVException(
3614-
utime_result, "utime", nullptr, dest_entry_path.c_str());
3616+
utime_result, "utime", nullptr, path);
36153617
return false;
36163618
}
36173619
}

0 commit comments

Comments
 (0)