mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-14 19:16:17 +00:00
cp: use the function from uucore
This commit is contained in:
parent
ff50a37635
commit
1180905b5e
2 changed files with 6 additions and 8 deletions
|
@ -30,6 +30,7 @@ uucore = { workspace = true, features = [
|
|||
"backup-control",
|
||||
"entries",
|
||||
"fs",
|
||||
"fsxattr",
|
||||
"perms",
|
||||
"mode",
|
||||
"update-control",
|
||||
|
|
|
@ -17,6 +17,8 @@ use std::os::unix::ffi::OsStrExt;
|
|||
#[cfg(unix)]
|
||||
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
|
||||
use std::path::{Path, PathBuf, StripPrefixError};
|
||||
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
|
||||
use uucore::fsxattr::copy_xattrs;
|
||||
|
||||
use clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command};
|
||||
use filetime::FileTime;
|
||||
|
@ -1603,16 +1605,11 @@ pub(crate) fn copy_attributes(
|
|||
})?;
|
||||
|
||||
handle_preserve(&attributes.xattr, || -> CopyResult<()> {
|
||||
#[cfg(all(unix, not(target_os = "android")))]
|
||||
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
|
||||
{
|
||||
let xattrs = xattr::list(source)?;
|
||||
for attr in xattrs {
|
||||
if let Some(attr_value) = xattr::get(source, attr.clone())? {
|
||||
xattr::set(dest, attr, &attr_value[..])?;
|
||||
}
|
||||
}
|
||||
copy_xattrs(source, dest)?;
|
||||
}
|
||||
#[cfg(not(all(unix, not(target_os = "android"))))]
|
||||
#[cfg(not(all(unix, not(any(target_os = "android", target_os = "macos")))))]
|
||||
{
|
||||
// The documentation for GNU cp states:
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue