From 94d38eee4cf352ca177e8ce2c7ca5d1e79f5de10 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Tue, 1 Sep 2020 10:24:17 +0800 Subject: replace utime crate with filetime (#7268) --- cli/Cargo.toml | 1 - cli/ops/fs.rs | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'cli') diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 7c8414e55..34b491d6a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -68,7 +68,6 @@ termcolor = "1.1.0" tokio = { version = "0.2.22", features = ["full"] } tokio-rustls = "0.14.0" url = "2.1.1" -utime = "0.3.1" webpki = "0.21.3" webpki-roots = "0.19.0" walkdir = "2.3.1" diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs index 794518e2c..9519ab0ab 100644 --- a/cli/ops/fs.rs +++ b/cli/ops/fs.rs @@ -1756,10 +1756,12 @@ fn op_utime_sync( let args: UtimeArgs = serde_json::from_value(args)?; let path = PathBuf::from(&args.path); + let atime = filetime::FileTime::from_unix_time(args.atime, 0); + let mtime = filetime::FileTime::from_unix_time(args.mtime, 0); state.check_write(&path)?; debug!("op_utime_sync {} {} {}", args.path, args.atime, args.mtime); - utime::set_file_times(args.path, args.atime, args.mtime)?; + filetime::set_file_times(path, atime, mtime)?; Ok(json!({})) } @@ -1773,12 +1775,14 @@ async fn op_utime_async( let args: UtimeArgs = serde_json::from_value(args)?; let path = PathBuf::from(&args.path); + let atime = filetime::FileTime::from_unix_time(args.atime, 0); + let mtime = filetime::FileTime::from_unix_time(args.mtime, 0); state.check_write(&path)?; tokio::task::spawn_blocking(move || { debug!("op_utime_async {} {} {}", args.path, args.atime, args.mtime); - utime::set_file_times(args.path, args.atime, args.mtime)?; + filetime::set_file_times(path, atime, mtime)?; Ok(json!({})) }) .await -- cgit v1.2.3