Skip to content

Commit

Permalink
Author: Andre Masella <[email protected]>
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
avarsava committed Apr 24, 2024
1 parent aa71db6 commit f0f535f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/fix_json_dir_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix build issue with json-dir-list on Windows and MacOS
1 change: 1 addition & 0 deletions json-dir-list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions json-dir-list/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()),
Expand Down

0 comments on commit f0f535f

Please sign in to comment.