@@ -3526,12 +3526,10 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35263526 if (!dereference &&
35273527 std::filesystem::is_directory (symlink_target) &&
35283528 isInsideDir (symlink_target, current_dest_symlink_target)) {
3529- std::string message =
3529+ static constexpr const char * message =
35303530 " Cannot copy %s to a subdirectory of self %s" ;
3531- THROW_ERR_FS_CP_EINVAL (env,
3532- message.c_str (),
3533- symlink_target.c_str (),
3534- current_dest_symlink_target.c_str ());
3531+ THROW_ERR_FS_CP_EINVAL (
3532+ env, message, symlink_target, current_dest_symlink_target);
35353533 return false ;
35363534 }
35373535
@@ -3540,12 +3538,10 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35403538 // and therefore a broken symlink would be created.
35413539 if (std::filesystem::is_directory (dest_file_path) &&
35423540 isInsideDir (current_dest_symlink_target, symlink_target)) {
3543- std::string message = " cannot overwrite %s with %s" ;
3541+ static constexpr const char * message =
3542+ " cannot overwrite %s with %s" ;
35443543 THROW_ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY (
3545- env,
3546- message.c_str (),
3547- current_dest_symlink_target.c_str (),
3548- symlink_target.c_str ());
3544+ env, message, current_dest_symlink_target, symlink_target);
35493545 return false ;
35503546 }
35513547
@@ -3597,7 +3593,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
35973593 THROW_ERR_FS_CP_EEXIST (isolate,
35983594 " [ERR_FS_CP_EEXIST]: Target already exists: "
35993595 " cp returned EEXIST (%s already exists)" ,
3600- dest_file_path. c_str () );
3596+ dest_file_path);
36013597 return false ;
36023598 }
36033599 env->ThrowStdErrException (error, " cp" , dest_str.c_str ());
0 commit comments