@@ -3423,15 +3423,18 @@ static void CpSyncOverrideFile(const FunctionCallbackInfo<Value>& args) {
34233423 THROW_IF_INSUFFICIENT_PERMISSIONS (
34243424 env, permission::PermissionScope::kFileSystemWrite , dest.ToStringView ());
34253425
3426+ auto src_path = src.ToPath ();
3427+ auto dest_path = dest.ToPath ();
3428+
34263429 std::error_code error;
34273430
3428- if (!std::filesystem::remove (*dest , error)) {
3431+ if (!std::filesystem::remove (dest_path , error)) {
34293432 return env->ThrowStdErrException (error, " unlink" , *dest);
34303433 }
34313434
34323435 if (mode == 0 ) {
34333436 // if no mode is specified use the faster std::filesystem API
3434- if (!std::filesystem::copy_file (*src, *dest , error)) {
3437+ if (!std::filesystem::copy_file (src_path, dest_path , error)) {
34353438 return env->ThrowStdErrException (error, " cp" , *dest);
34363439 }
34373440 } else {
@@ -3444,7 +3447,7 @@ static void CpSyncOverrideFile(const FunctionCallbackInfo<Value>& args) {
34443447 }
34453448
34463449 if (preserve_timestamps) {
3447- CopyUtimes (*src, *dest , env);
3450+ CopyUtimes (src_path, dest_path , env);
34483451 }
34493452}
34503453
@@ -3487,8 +3490,11 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
34873490 bool verbatim_symlinks = args[5 ]->IsTrue ();
34883491 bool preserve_timestamps = args[6 ]->IsTrue ();
34893492
3493+ auto src_path = src.ToPath ();
3494+ auto dest_path = dest.ToPath ();
3495+
34903496 std::error_code error;
3491- std::filesystem::create_directories (*dest , error);
3497+ std::filesystem::create_directories (dest_path , error);
34923498 if (error) {
34933499 return env->ThrowStdErrException (error, " cp" , *dest);
34943500 }
@@ -3630,7 +3636,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
36303636 return true ;
36313637 };
36323638
3633- copy_dir_contents (std::filesystem::path (*src), std::filesystem::path (*dest) );
3639+ copy_dir_contents (src_path, dest_path );
36343640}
36353641
36363642BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile (
0 commit comments