mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #8200 from sylvestre/l10n-cp
l10n: port cp for translation + add french
This commit is contained in:
+100
-1
@@ -14,4 +14,103 @@ cp-after-help = Do not copy a non-directory that has an existing destination wit
|
||||
|
||||
- all This is the default operation when an --update option is not specified, and results in all existing files in the destination being replaced.
|
||||
- none This is similar to the --no-clobber option, in that no files in the destination are replaced, but also skipping a file does not induce a failure.
|
||||
- older This is the default operation when --update is specified, and results in files being replaced if they’re older than the corresponding source file.
|
||||
- older This is the default operation when --update is specified, and results in files being replaced if they're older than the corresponding source file.
|
||||
|
||||
# Help messages
|
||||
cp-help-target-directory = copy all SOURCE arguments into target-directory
|
||||
cp-help-no-target-directory = Treat DEST as a regular file and not a directory
|
||||
cp-help-interactive = ask before overwriting files
|
||||
cp-help-link = hard-link files instead of copying
|
||||
cp-help-no-clobber = don't overwrite a file that already exists
|
||||
cp-help-recursive = copy directories recursively
|
||||
cp-help-strip-trailing-slashes = remove any trailing slashes from each SOURCE argument
|
||||
cp-help-debug = explain how a file is copied. Implies -v
|
||||
cp-help-verbose = explicitly state what is being done
|
||||
cp-help-symbolic-link = make symbolic links instead of copying
|
||||
cp-help-force = if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used). Currently not implemented for Windows.
|
||||
cp-help-remove-destination = remove each existing destination file before attempting to open it (contrast with --force). On Windows, currently only works for writeable files.
|
||||
cp-help-reflink = control clone/CoW copies. See below
|
||||
cp-help-attributes-only = Don't copy the file data, just the attributes
|
||||
cp-help-preserve = Preserve the specified attributes (default: mode, ownership (unix only), timestamps), if possible additional attributes: context, links, xattr, all
|
||||
cp-help-preserve-default = same as --preserve=mode,ownership(unix only),timestamps
|
||||
cp-help-no-preserve = don't preserve the specified attributes
|
||||
cp-help-parents = use full source file name under DIRECTORY
|
||||
cp-help-no-dereference = never follow symbolic links in SOURCE
|
||||
cp-help-dereference = always follow symbolic links in SOURCE
|
||||
cp-help-cli-symbolic-links = follow command-line symbolic links in SOURCE
|
||||
cp-help-archive = Same as -dR --preserve=all
|
||||
cp-help-no-dereference-preserve-links = same as --no-dereference --preserve=links
|
||||
cp-help-one-file-system = stay on this file system
|
||||
cp-help-sparse = control creation of sparse files. See below
|
||||
cp-help-selinux = set SELinux security context of destination file to default type
|
||||
cp-help-context = like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX
|
||||
cp-help-progress = Display a progress bar. Note: this feature is not supported by GNU coreutils.
|
||||
cp-help-copy-contents = NotImplemented: copy contents of special files when recursive
|
||||
|
||||
# Error messages
|
||||
cp-error-missing-file-operand = missing file operand
|
||||
cp-error-missing-destination-operand = missing destination file operand after { $source }
|
||||
cp-error-extra-operand = extra operand { $operand }
|
||||
cp-error-same-file = { $source } and { $dest } are the same file
|
||||
cp-error-backing-up-destroy-source = backing up { $dest } might destroy source; { $source } not copied
|
||||
cp-error-cannot-open-for-reading = cannot open { $source } for reading
|
||||
cp-error-not-writing-dangling-symlink = not writing through dangling symlink { $dest }
|
||||
cp-error-failed-to-clone = failed to clone { $source } from { $dest }: { $error }
|
||||
cp-error-cannot-change-attribute = cannot change attribute { $dest }: Source file is a non regular file
|
||||
cp-error-cannot-stat = cannot stat { $source }: No such file or directory
|
||||
cp-error-cannot-create-symlink = cannot create symlink { $dest } to { $source }
|
||||
cp-error-cannot-create-hard-link = cannot create hard link { $dest } to { $source }
|
||||
cp-error-omitting-directory = -r not specified; omitting directory { $dir }
|
||||
cp-error-cannot-copy-directory-into-itself = cannot copy a directory, { $source }, into itself, { $dest }
|
||||
cp-error-will-not-copy-through-symlink = will not copy { $source } through just-created symlink { $dest }
|
||||
cp-error-will-not-overwrite-just-created = will not overwrite just-created { $dest } with { $source }
|
||||
cp-error-target-not-directory = target: { $target } is not a directory
|
||||
cp-error-cannot-overwrite-directory-with-non-directory = cannot overwrite directory { $dir } with non-directory
|
||||
cp-error-cannot-overwrite-non-directory-with-directory = cannot overwrite non-directory with directory
|
||||
cp-error-with-parents-dest-must-be-dir = with --parents, the destination must be a directory
|
||||
cp-error-not-replacing = not replacing { $file }
|
||||
cp-error-failed-get-current-dir = failed to get current directory { $error }
|
||||
cp-error-failed-set-permissions = cannot set permissions { $path }
|
||||
cp-error-backup-mutually-exclusive = options --backup and --no-clobber are mutually exclusive
|
||||
cp-error-invalid-argument = invalid argument { $arg } for '{ $option }'
|
||||
cp-error-option-not-implemented = Option '{ $option }' not yet implemented.
|
||||
cp-error-not-all-files-copied = Not all files were copied
|
||||
cp-error-reflink-always-sparse-auto = `--reflink=always` can be used only with --sparse=auto
|
||||
cp-error-file-exists = { $path }: File exists
|
||||
cp-error-invalid-backup-argument = --backup is mutually exclusive with -n or --update=none-fail
|
||||
cp-error-reflink-not-supported = --reflink is only supported on linux and macOS
|
||||
cp-error-sparse-not-supported = --sparse is only supported on linux
|
||||
cp-error-not-a-directory = { $path } is not a directory
|
||||
cp-error-selinux-not-enabled = SELinux was not enabled during the compile time!
|
||||
cp-error-selinux-set-context = failed to set the security context of { $path }: { $error }
|
||||
cp-error-selinux-get-context = failed to get security context of { $path }
|
||||
cp-error-selinux-error = SELinux error: { $error }
|
||||
cp-error-cannot-create-fifo = cannot create fifo { $path }: File exists
|
||||
cp-error-invalid-attribute = invalid attribute { $value }
|
||||
cp-error-failed-to-create-whole-tree = failed to create whole tree
|
||||
cp-error-failed-to-create-directory = Failed to create directory: { $error }
|
||||
cp-error-backup-format = cp: { $error }
|
||||
Try '{ $exec } --help' for more information.
|
||||
|
||||
# Debug enum strings
|
||||
cp-debug-enum-no = no
|
||||
cp-debug-enum-yes = yes
|
||||
cp-debug-enum-avoided = avoided
|
||||
cp-debug-enum-unsupported = unsupported
|
||||
cp-debug-enum-unknown = unknown
|
||||
cp-debug-enum-zeros = zeros
|
||||
cp-debug-enum-seek-hole = SEEK_HOLE
|
||||
cp-debug-enum-seek-hole-zeros = SEEK_HOLE + zeros
|
||||
|
||||
# Warning messages
|
||||
cp-warning-source-specified-more-than-once = source { $file_type } { $source } specified more than once
|
||||
|
||||
# Verbose and debug messages
|
||||
cp-verbose-copied = { $source } -> { $dest }
|
||||
cp-debug-skipped = skipped { $path }
|
||||
cp-verbose-created-directory = { $source } -> { $dest }
|
||||
cp-debug-copy-offload = copy offload: { $offload }, reflink: { $reflink }, sparse detection: { $sparse }
|
||||
|
||||
# Prompts
|
||||
cp-prompt-overwrite = overwrite { $path }?
|
||||
cp-prompt-overwrite-with-mode = replace { $path }, overriding mode
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
cp-about = Copier SOURCE vers DEST, ou plusieurs SOURCE(s) vers RÉPERTOIRE.
|
||||
cp-usage = cp [OPTION]... [-T] SOURCE DEST
|
||||
cp [OPTION]... SOURCE... RÉPERTOIRE
|
||||
cp [OPTION]... -t RÉPERTOIRE SOURCE...
|
||||
cp-after-help = Ne pas copier un non-répertoire qui a une destination existante avec le même horodatage de modification ou plus récent ;
|
||||
à la place, ignorer silencieusement le fichier sans échec. Si les horodatages sont préservés, la comparaison est faite avec
|
||||
l'horodatage source tronqué aux résolutions du système de fichiers de destination et des appels système utilisés pour
|
||||
mettre à jour les horodatages ; cela évite le travail en double si plusieurs commandes cp -pu sont exécutées avec la même source
|
||||
et destination. Cette option est ignorée si l'option -n ou --no-clobber est également spécifiée. De plus, si
|
||||
--preserve=links est également spécifié (comme avec cp -au par exemple), cela aura la priorité ; par conséquent,
|
||||
selon l'ordre dans lequel les fichiers sont traités depuis la source, les fichiers plus récents dans la destination peuvent être remplacés,
|
||||
pour refléter les liens durs dans la source. ce qui donne plus de contrôle sur les fichiers existants dans la destination qui sont
|
||||
remplacés, et sa valeur peut être l'une des suivantes :
|
||||
|
||||
- all C'est l'opération par défaut lorsqu'une option --update n'est pas spécifiée, et entraîne le remplacement de tous les fichiers existants dans la destination.
|
||||
- none Cela est similaire à l'option --no-clobber, en ce sens qu'aucun fichier dans la destination n'est remplacé, mais ignorer un fichier n'induit pas d'échec.
|
||||
- older C'est l'opération par défaut lorsque --update est spécifié, et entraîne le remplacement des fichiers s'ils sont plus anciens que le fichier source correspondant.
|
||||
|
||||
# Messages d'aide
|
||||
cp-help-target-directory = copier tous les arguments SOURCE dans le répertoire cible
|
||||
cp-help-no-target-directory = Traiter DEST comme un fichier régulier et non comme un répertoire
|
||||
cp-help-interactive = demander avant d'écraser les fichiers
|
||||
cp-help-link = créer des liens durs au lieu de copier
|
||||
cp-help-no-clobber = ne pas écraser un fichier qui existe déjà
|
||||
cp-help-recursive = copier les répertoires récursivement
|
||||
cp-help-strip-trailing-slashes = supprimer les barres obliques finales de chaque argument SOURCE
|
||||
cp-help-debug = expliquer comment un fichier est copié. Implique -v
|
||||
cp-help-verbose = indiquer explicitement ce qui est fait
|
||||
cp-help-symbolic-link = créer des liens symboliques au lieu de copier
|
||||
cp-help-force = si un fichier de destination existant ne peut pas être ouvert, le supprimer et réessayer (cette option est ignorée lorsque l'option -n est également utilisée). Actuellement non implémenté pour Windows.
|
||||
cp-help-remove-destination = supprimer chaque fichier de destination existant avant de tenter de l'ouvrir (contraste avec --force). Sur Windows, ne fonctionne actuellement que pour les fichiers inscriptibles.
|
||||
cp-help-reflink = contrôler les copies clone/CoW. Voir ci-dessous
|
||||
cp-help-attributes-only = Ne pas copier les données du fichier, juste les attributs
|
||||
cp-help-preserve = Préserver les attributs spécifiés (par défaut : mode, propriété (unix uniquement), horodatages), si possible attributs supplémentaires : contexte, liens, xattr, all
|
||||
cp-help-preserve-default = identique à --preserve=mode,ownership(unix uniquement),timestamps
|
||||
cp-help-no-preserve = ne pas préserver les attributs spécifiés
|
||||
cp-help-parents = utiliser le nom complet du fichier source sous RÉPERTOIRE
|
||||
cp-help-no-dereference = ne jamais suivre les liens symboliques dans SOURCE
|
||||
cp-help-dereference = toujours suivre les liens symboliques dans SOURCE
|
||||
cp-help-cli-symbolic-links = suivre les liens symboliques de la ligne de commande dans SOURCE
|
||||
cp-help-archive = Identique à -dR --preserve=all
|
||||
cp-help-no-dereference-preserve-links = identique à --no-dereference --preserve=links
|
||||
cp-help-one-file-system = rester sur ce système de fichiers
|
||||
cp-help-sparse = contrôler la création de fichiers épars. Voir ci-dessous
|
||||
cp-help-selinux = définir le contexte de sécurité SELinux du fichier de destination au type par défaut
|
||||
cp-help-context = comme -Z, ou si CTX est spécifié, définir le contexte de sécurité SELinux ou SMACK à CTX
|
||||
cp-help-progress = Afficher une barre de progression. Note : cette fonctionnalité n'est pas supportée par GNU coreutils.
|
||||
cp-help-copy-contents = Non implémenté : copier le contenu des fichiers spéciaux lors de la récursion
|
||||
|
||||
# Messages d'erreur
|
||||
cp-error-missing-file-operand = opérande fichier manquant
|
||||
cp-error-missing-destination-operand = opérande fichier de destination manquant après { $source }
|
||||
cp-error-extra-operand = opérande supplémentaire { $operand }
|
||||
cp-error-same-file = { $source } et { $dest } sont le même fichier
|
||||
cp-error-backing-up-destroy-source = sauvegarder { $dest } pourrait détruire la source ; { $source } non copié
|
||||
cp-error-cannot-open-for-reading = impossible d'ouvrir { $source } en lecture
|
||||
cp-error-not-writing-dangling-symlink = ne pas écrire à travers le lien symbolique pendant { $dest }
|
||||
cp-error-failed-to-clone = échec du clonage de { $source } depuis { $dest } : { $error }
|
||||
cp-error-cannot-change-attribute = impossible de changer l'attribut { $dest } : Le fichier source n'est pas un fichier régulier
|
||||
cp-error-cannot-stat = impossible de faire stat sur { $source } : Aucun fichier ou répertoire de ce type
|
||||
cp-error-cannot-create-symlink = impossible de créer le lien symbolique { $dest } vers { $source }
|
||||
cp-error-cannot-create-hard-link = impossible de créer le lien dur { $dest } vers { $source }
|
||||
cp-error-omitting-directory = -r non spécifié ; répertoire { $dir } omis
|
||||
cp-error-cannot-copy-directory-into-itself = impossible de copier un répertoire, { $source }, dans lui-même, { $dest }
|
||||
cp-error-will-not-copy-through-symlink = ne copiera pas { $source } à travers le lien symbolique tout juste créé { $dest }
|
||||
cp-error-will-not-overwrite-just-created = n'écrasera pas le fichier tout juste créé { $dest } avec { $source }
|
||||
cp-error-target-not-directory = cible : { $target } n'est pas un répertoire
|
||||
cp-error-cannot-overwrite-directory-with-non-directory = impossible d'écraser le répertoire { $dir } avec un non-répertoire
|
||||
cp-error-cannot-overwrite-non-directory-with-directory = impossible d'écraser un non-répertoire avec un répertoire
|
||||
cp-error-with-parents-dest-must-be-dir = avec --parents, la destination doit être un répertoire
|
||||
cp-error-not-replacing = ne remplace pas { $file }
|
||||
cp-error-failed-get-current-dir = échec de l'obtention du répertoire actuel { $error }
|
||||
cp-error-failed-set-permissions = impossible de définir les permissions { $path }
|
||||
cp-error-backup-mutually-exclusive = les options --backup et --no-clobber sont mutuellement exclusives
|
||||
cp-error-invalid-argument = argument invalide { $arg } pour '{ $option }'
|
||||
cp-error-option-not-implemented = Option '{ $option }' pas encore implémentée.
|
||||
cp-error-not-all-files-copied = Tous les fichiers n'ont pas été copiés
|
||||
cp-error-reflink-always-sparse-auto = `--reflink=always` ne peut être utilisé qu'avec --sparse=auto
|
||||
cp-error-file-exists = { $path } : Le fichier existe
|
||||
cp-error-invalid-backup-argument = --backup est mutuellement exclusif avec -n ou --update=none-fail
|
||||
cp-error-reflink-not-supported = --reflink n'est supporté que sur linux et macOS
|
||||
cp-error-sparse-not-supported = --sparse n'est supporté que sur linux
|
||||
cp-error-not-a-directory = { $path } n'est pas un répertoire
|
||||
cp-error-selinux-not-enabled = SELinux n'était pas activé lors de la compilation !
|
||||
cp-error-selinux-set-context = échec de la définition du contexte de sécurité de { $path } : { $error }
|
||||
cp-error-selinux-get-context = échec de l'obtention du contexte de sécurité de { $path }
|
||||
cp-error-selinux-error = Erreur SELinux : { $error }
|
||||
cp-error-cannot-create-fifo = impossible de créer le fifo { $path } : Le fichier existe
|
||||
cp-error-invalid-attribute = attribut invalide { $value }
|
||||
cp-error-failed-to-create-whole-tree = échec de la création de l'arborescence complète
|
||||
cp-error-failed-to-create-directory = Échec de la création du répertoire : { $error }
|
||||
cp-error-backup-format = cp : { $error }
|
||||
Tentez '{ $exec } --help' pour plus d'informations.
|
||||
|
||||
# Debug enum strings
|
||||
cp-debug-enum-no = non
|
||||
cp-debug-enum-yes = oui
|
||||
cp-debug-enum-avoided = évité
|
||||
cp-debug-enum-unsupported = non supporté
|
||||
cp-debug-enum-unknown = inconnu
|
||||
cp-debug-enum-zeros = zéros
|
||||
cp-debug-enum-seek-hole = SEEK_HOLE
|
||||
cp-debug-enum-seek-hole-zeros = SEEK_HOLE + zéros
|
||||
|
||||
# Messages d'avertissement
|
||||
cp-warning-source-specified-more-than-once = { $file_type } source { $source } spécifié plus d'une fois
|
||||
|
||||
# Messages verbeux et de débogage
|
||||
cp-verbose-copied = { $source } -> { $dest }
|
||||
cp-debug-skipped = { $path } ignoré
|
||||
cp-verbose-created-directory = { $source } -> { $dest }
|
||||
cp-debug-copy-offload = copy offload : { $offload }, reflink : { $reflink }, sparse detection : { $sparse }
|
||||
|
||||
# Invites
|
||||
cp-prompt-overwrite = écraser { $path } ?
|
||||
cp-prompt-overwrite-with-mode = remplacer { $path }, en écrasant le mode
|
||||
+38
-10
@@ -20,6 +20,7 @@ use uucore::error::UIoError;
|
||||
use uucore::fs::{
|
||||
FileInformation, MissingHandling, ResolveMode, canonicalize, path_ends_with_terminator,
|
||||
};
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
use uucore::show;
|
||||
use uucore::show_error;
|
||||
use uucore::uio_error;
|
||||
@@ -183,7 +184,13 @@ impl Entry {
|
||||
let source_is_dir = source.is_dir();
|
||||
if path_ends_with_terminator(context.target) && source_is_dir {
|
||||
if let Err(e) = fs::create_dir_all(context.target) {
|
||||
eprintln!("Failed to create directory: {e}");
|
||||
eprintln!(
|
||||
"{}",
|
||||
get_message_with_args(
|
||||
"cp-error-failed-to-create-directory",
|
||||
HashMap::from([("error".to_string(), e.to_string())])
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
descendant = descendant.strip_prefix(context.root)?.to_path_buf();
|
||||
@@ -229,7 +236,7 @@ fn copy_direntry(
|
||||
// exist, ...
|
||||
if source_absolute.is_dir() && !local_to_target.exists() {
|
||||
return if target_is_file {
|
||||
Err("cannot overwrite non-directory with directory".into())
|
||||
Err(get_message("cp-error-cannot-overwrite-non-directory-with-directory").into())
|
||||
} else {
|
||||
build_dir(&local_to_target, false, options, Some(&source_absolute))?;
|
||||
if options.verbose {
|
||||
@@ -269,8 +276,14 @@ fn copy_direntry(
|
||||
CpError::IoErrContext(e, _) if e.kind() == io::ErrorKind::PermissionDenied => {
|
||||
show!(uio_error!(
|
||||
e,
|
||||
"cannot open {} for reading",
|
||||
source_relative.quote(),
|
||||
"{}",
|
||||
get_message_with_args(
|
||||
"cp-error-cannot-open-for-reading",
|
||||
HashMap::from([(
|
||||
"source".to_string(),
|
||||
source_relative.quote().to_string()
|
||||
)])
|
||||
),
|
||||
));
|
||||
}
|
||||
e => return Err(e),
|
||||
@@ -315,15 +328,24 @@ pub(crate) fn copy_directory(
|
||||
}
|
||||
|
||||
if !options.recursive {
|
||||
return Err(format!("-r not specified; omitting directory {}", root.quote()).into());
|
||||
return Err(get_message_with_args(
|
||||
"cp-error-omitting-directory",
|
||||
HashMap::from([("dir".to_string(), root.quote().to_string())]),
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
// check if root is a prefix of target
|
||||
if path_has_prefix(target, root)? {
|
||||
return Err(format!(
|
||||
"cannot copy a directory, {}, into itself, {}",
|
||||
root.quote(),
|
||||
target.join(root.file_name().unwrap()).quote()
|
||||
return Err(get_message_with_args(
|
||||
"cp-error-cannot-copy-directory-into-itself",
|
||||
HashMap::from([
|
||||
("source".to_string(), root.quote().to_string()),
|
||||
(
|
||||
"dest".to_string(),
|
||||
target.join(root.file_name().unwrap()).quote().to_string(),
|
||||
),
|
||||
]),
|
||||
)
|
||||
.into());
|
||||
}
|
||||
@@ -368,7 +390,13 @@ pub(crate) fn copy_directory(
|
||||
// the target directory.
|
||||
let context = match Context::new(root, target) {
|
||||
Ok(c) => c,
|
||||
Err(e) => return Err(format!("failed to get current directory {e}").into()),
|
||||
Err(e) => {
|
||||
return Err(get_message_with_args(
|
||||
"cp-error-failed-get-current-dir",
|
||||
HashMap::from([("error".to_string(), e.to_string())]),
|
||||
)
|
||||
.into());
|
||||
}
|
||||
};
|
||||
|
||||
// The directory we were in during the previous iteration
|
||||
|
||||
+275
-162
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ use std::os::unix::fs::{FileTypeExt, OpenOptionsExt};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::Path;
|
||||
use uucore::buf_copy;
|
||||
|
||||
use uucore::locale::get_message;
|
||||
use uucore::mode::get_umask;
|
||||
|
||||
use crate::{
|
||||
@@ -401,7 +401,7 @@ pub(crate) fn copy_on_write(
|
||||
clone(source, dest, CloneFallback::Error)
|
||||
}
|
||||
(ReflinkMode::Always, _) => {
|
||||
return Err("`--reflink=always` can be used only with --sparse=auto".into());
|
||||
return Err(get_message("cp-error-reflink-always-sparse-auto").into());
|
||||
}
|
||||
};
|
||||
result.map_err(|e| CpError::IoErrContext(e, context.to_owned()))?;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
// spell-checker:ignore reflink
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::CString;
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
@@ -10,6 +11,7 @@ use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::path::Path;
|
||||
|
||||
use uucore::buf_copy;
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
use uucore::mode::get_umask;
|
||||
|
||||
use crate::{
|
||||
@@ -30,7 +32,9 @@ pub(crate) fn copy_on_write(
|
||||
source_is_stream: bool,
|
||||
) -> CopyResult<CopyDebug> {
|
||||
if sparse_mode != SparseMode::Auto {
|
||||
return Err("--sparse is only supported on linux".to_string().into());
|
||||
return Err(get_message("cp-error-sparse-not-supported")
|
||||
.to_string()
|
||||
.into());
|
||||
}
|
||||
let mut copy_debug = CopyDebug {
|
||||
offload: OffloadReflinkDebug::Unknown,
|
||||
@@ -85,10 +89,13 @@ pub(crate) fn copy_on_write(
|
||||
// support COW).
|
||||
match reflink_mode {
|
||||
ReflinkMode::Always => {
|
||||
return Err(format!(
|
||||
"failed to clone {} from {}: {error}",
|
||||
source.display(),
|
||||
dest.display()
|
||||
return Err(get_message_with_args(
|
||||
"cp-error-failed-to-clone",
|
||||
HashMap::from([
|
||||
("source".to_string(), source.display().to_string()),
|
||||
("dest".to_string(), dest.display().to_string()),
|
||||
("error".to_string(), error.to_string()),
|
||||
]),
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// spell-checker:ignore reflink
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use uucore::locale::get_message;
|
||||
|
||||
use crate::{
|
||||
CopyDebug, CopyResult, CpError, OffloadReflinkDebug, ReflinkMode, SparseDebug, SparseMode,
|
||||
@@ -19,12 +20,14 @@ pub(crate) fn copy_on_write(
|
||||
context: &str,
|
||||
) -> CopyResult<CopyDebug> {
|
||||
if reflink_mode != ReflinkMode::Never {
|
||||
return Err("--reflink is only supported on linux and macOS"
|
||||
return Err(get_message("cp-error-reflink-not-supported")
|
||||
.to_string()
|
||||
.into());
|
||||
}
|
||||
if sparse_mode != SparseMode::Auto {
|
||||
return Err("--sparse is only supported on linux".to_string().into());
|
||||
return Err(get_message("cp-error-sparse-not-supported")
|
||||
.to_string()
|
||||
.into());
|
||||
}
|
||||
let copy_debug = CopyDebug {
|
||||
offload: OffloadReflinkDebug::Unsupported,
|
||||
|
||||
@@ -8,6 +8,7 @@ use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::path::Path;
|
||||
|
||||
use uucore::buf_copy;
|
||||
use uucore::locale::get_message;
|
||||
use uucore::mode::get_umask;
|
||||
|
||||
use crate::{
|
||||
@@ -25,12 +26,14 @@ pub(crate) fn copy_on_write(
|
||||
source_is_stream: bool,
|
||||
) -> CopyResult<CopyDebug> {
|
||||
if reflink_mode != ReflinkMode::Never {
|
||||
return Err("--reflink is only supported on linux and macOS"
|
||||
return Err(get_message("cp-error-reflink-not-supported")
|
||||
.to_string()
|
||||
.into());
|
||||
}
|
||||
if sparse_mode != SparseMode::Auto {
|
||||
return Err("--sparse is only supported on linux".to_string().into());
|
||||
return Err(get_message("cp-error-sparse-not-supported")
|
||||
.to_string()
|
||||
.into());
|
||||
}
|
||||
let copy_debug = CopyDebug {
|
||||
offload: OffloadReflinkDebug::Unsupported,
|
||||
|
||||
Reference in New Issue
Block a user