@@ -3495,10 +3495,12 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
34953495 std::filesystem::path dest) {
34963496 std::error_code error;
34973497 for (auto dir_entry : std::filesystem::directory_iterator (src)) {
3498+ auto dir_entry_path_str = PathToString (dir_entry.path ());
34983499 auto dest_file_path = dest / dir_entry.path ().filename ();
3500+ auto dest_file_path_str = PathToString (dest_file_path);
34993501
35003502 if (filter_fn &&
3501- !(*filter_fn)(dir_entry. path (). c_str (), dest_file_path .c_str ())) {
3503+ !(*filter_fn)(dir_entry_path_str. c_str (), dest_file_path_str .c_str ())) {
35023504 continue ;
35033505 }
35043506
@@ -3565,7 +3567,6 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35653567 }
35663568 } else if (std::filesystem::is_regular_file (dest_file_path)) {
35673569 if (!dereference || (!force && error_on_exist)) {
3568- auto dest_file_path_str = PathToString (dest_file_path);
35693570 env->ThrowStdErrException (
35703571 std::make_error_code (std::errc::file_exists),
35713572 " cp" ,
@@ -3614,7 +3615,6 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
36143615 uv_fs_t req;
36153616 auto cleanup = OnScopeLeave ([&req]() { uv_fs_req_cleanup (&req); });
36163617
3617- auto dir_entry_path_str = PathToString (dir_entry.path ());
36183618 int result =
36193619 uv_fs_stat (nullptr , &req, dir_entry_path_str.c_str (), nullptr );
36203620 if (is_uv_error (result)) {
@@ -3629,7 +3629,6 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
36293629 const double source_mtime =
36303630 s->st_mtim .tv_sec + s->st_mtim .tv_nsec / 1e9 ;
36313631
3632- auto dest_file_path_str = PathToString (dest_file_path);
36333632 int utime_result = uv_fs_utime (nullptr ,
36343633 &req,
36353634 dest_file_path_str.c_str (),
0 commit comments