mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 03:26:18 +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",
|
"backup-control",
|
||||||
"entries",
|
"entries",
|
||||||
"fs",
|
"fs",
|
||||||
|
"fsxattr",
|
||||||
"perms",
|
"perms",
|
||||||
"mode",
|
"mode",
|
||||||
"update-control",
|
"update-control",
|
||||||
|
|
|
@ -17,6 +17,8 @@ use std::os::unix::ffi::OsStrExt;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
|
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
|
||||||
use std::path::{Path, PathBuf, StripPrefixError};
|
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 clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command};
|
||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
|
@ -1603,16 +1605,11 @@ pub(crate) fn copy_attributes(
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
handle_preserve(&attributes.xattr, || -> CopyResult<()> {
|
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)?;
|
copy_xattrs(source, dest)?;
|
||||||
for attr in xattrs {
|
|
||||||
if let Some(attr_value) = xattr::get(source, attr.clone())? {
|
|
||||||
xattr::set(dest, attr, &attr_value[..])?;
|
|
||||||
}
|
}
|
||||||
}
|
#[cfg(not(all(unix, not(any(target_os = "android", target_os = "macos")))))]
|
||||||
}
|
|
||||||
#[cfg(not(all(unix, not(target_os = "android"))))]
|
|
||||||
{
|
{
|
||||||
// The documentation for GNU cp states:
|
// The documentation for GNU cp states:
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue