@@ -3432,15 +3432,18 @@ static void CpSyncOverrideFile(const FunctionCallbackInfo<Value>& args) {
34323432 THROW_IF_INSUFFICIENT_PERMISSIONS (
34333433 env, permission::PermissionScope::kFileSystemWrite , dest.ToStringView ());
34343434
3435+ auto src_path = src.ToPath ();
3436+ auto dest_path = dest.ToPath ();
3437+
34353438 std::error_code error;
34363439
3437- if (!std::filesystem::remove (*dest , error)) {
3440+ if (!std::filesystem::remove (dest_path , error)) {
34383441 return env->ThrowStdErrException (error, " unlink" , *dest);
34393442 }
34403443
34413444 if (mode == 0 ) {
34423445 // if no mode is specified use the faster std::filesystem API
3443- if (!std::filesystem::copy_file (*src, *dest , error)) {
3446+ if (!std::filesystem::copy_file (src_path, dest_path , error)) {
34443447 return env->ThrowStdErrException (error, " cp" , *dest);
34453448 }
34463449 } else {
@@ -3453,7 +3456,7 @@ static void CpSyncOverrideFile(const FunctionCallbackInfo<Value>& args) {
34533456 }
34543457
34553458 if (preserve_timestamps) {
3456- CopyUtimes (*src, *dest , env);
3459+ CopyUtimes (src_path, dest_path , env);
34573460 }
34583461}
34593462
@@ -3496,8 +3499,11 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
34963499 bool verbatim_symlinks = args[5 ]->IsTrue ();
34973500 bool preserve_timestamps = args[6 ]->IsTrue ();
34983501
3502+ auto src_path = src.ToPath ();
3503+ auto dest_path = dest.ToPath ();
3504+
34993505 std::error_code error;
3500- std::filesystem::create_directories (*dest , error);
3506+ std::filesystem::create_directories (dest_path , error);
35013507 if (error) {
35023508 return env->ThrowStdErrException (error, " cp" , *dest);
35033509 }
@@ -3639,7 +3645,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
36393645 return true ;
36403646 };
36413647
3642- copy_dir_contents (std::filesystem::path (*src), std::filesystem::path (*dest) );
3648+ copy_dir_contents (src_path, dest_path );
36433649}
36443650
36453651BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile (
0 commit comments