- // @todo Replace drupal_set_message() calls with exceptions instead.
- drupal_set_message(t('The specified file %file could not be moved/copied because no file by that name exists. Please check that you supplied the correct filename.', ['%file' => $original_source]), 'error');
- if (($realpath = drupal_realpath($original_source)) !== FALSE) {
+ // @todo Replace \Drupal::messenger()->addError() calls with exceptions
+ // instead.
+ \Drupal::messenger()->addError(t('The specified file %file could not be moved/copied because no file by that name exists. Please check that you supplied the correct filename.', ['%file' => $original_source]));
+ if (($realpath = $file_system->realpath($original_source)) !== FALSE) {