From f0f535fe26ce9c61afb07ac5c92b05a9d4a72bdd Mon Sep 17 00:00:00 2001 From: Alexis Varsava Date: Wed, 24 Apr 2024 10:19:58 -0400 Subject: [PATCH] Author: Andre Masella Date: Wed Apr 10 15:22:49 2024 -0400 Update `json-dir-list` to build on Windows and MacOS This is a requirement because we want to build ShAWK on those platforms. --- changes/fix_json_dir_list.md | 1 + json-dir-list/Cargo.toml | 1 + json-dir-list/src/main.rs | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changes/fix_json_dir_list.md diff --git a/changes/fix_json_dir_list.md b/changes/fix_json_dir_list.md new file mode 100644 index 000000000..be3810349 --- /dev/null +++ b/changes/fix_json_dir_list.md @@ -0,0 +1 @@ +* Fix build issue with json-dir-list on Windows and MacOS diff --git a/json-dir-list/Cargo.toml b/json-dir-list/Cargo.toml index daa9dea39..d96f3371f 100644 --- a/json-dir-list/Cargo.toml +++ b/json-dir-list/Cargo.toml @@ -17,5 +17,6 @@ chrono = "^0.4" gethostname = "^0.4" serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" + [target.'cfg(unix)'.dependencies] users = "^0.11" diff --git a/json-dir-list/src/main.rs b/json-dir-list/src/main.rs index f7ad398fe..aea9a8f53 100644 --- a/json-dir-list/src/main.rs +++ b/json-dir-list/src/main.rs @@ -68,7 +68,7 @@ fn write_record( host: &str, fetched: &str, entry: &std::fs::DirEntry, - metadata: impl std::os::windows::fs::MetadataExt, + metadata: &impl std::os::windows::fs::MetadataExt, ) { // Windows timespecs are 100ns ticks from January 1, 1601 fn to_seconds(time: u64) -> f64 { @@ -84,7 +84,7 @@ fn write_record( atime: to_seconds(metadata.last_access_time()), ctime: to_seconds(metadata.creation_time()), fetched, - file: file.to_str().expect("File name is not Unicode"), + file: entry.path().to_str().expect("File name is not Unicode"), group: "", host, mtime: to_seconds(metadata.last_write_time()),