0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

replace utime crate with filetime (#7268)

This commit is contained in:
Casper Beyer 2020-09-01 10:24:17 +08:00 committed by GitHub
parent b751122e10
commit 94d38eee4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 14 deletions

11
Cargo.lock generated
View file

@ -381,7 +381,6 @@ dependencies = [
"tokio-rustls 0.14.0",
"tokio-tungstenite",
"url",
"utime",
"uuid",
"walkdir",
"warp",
@ -2777,16 +2776,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
[[package]]
name = "utime"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91baa0c65eabd12fcbdac8cc35ff16159cab95cae96d0222d6d0271db6193cef"
dependencies = [
"libc",
"winapi 0.3.9",
]
[[package]]
name = "uuid"
version = "0.8.1"

View file

@ -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"

View file

@ -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