diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-02-01 17:25:42 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-02-01 17:25:42 +1300 |
commit | 6b76c382117f5551b90507cea9121c9cbd500e60 (patch) | |
tree | 8562428540ab9d4d72557638f6b753828601c702 /src/entry.rs | |
parent | fb80ee168e1977230680115304103b80ccf7f1ac (diff) | |
download | vagabond-6b76c382117f5551b90507cea9121c9cbd500e60.zip |
Only copy modified files
When copying a file, if a file already exists at the destination path
with the same last-modified date and the same size, the file is not
copied.
Diffstat (limited to 'src/entry.rs')
-rw-r--r-- | src/entry.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/entry.rs b/src/entry.rs index 72eeb7e..1b6b577 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -1,6 +1,9 @@ -use std::path::{Path, PathBuf}; use crate::*; +use std::path::{Path, PathBuf}; +use std::time::SystemTime; + + #[derive(PartialEq)] pub enum EntryType { File, @@ -17,6 +20,8 @@ pub struct Entry { pub path: PathBuf, /// The file path as originally presented to the [Entry] constructor. pub original_path: PathBuf, + /// Not available on all platforms. + pub last_modified: Option<SystemTime>, } impl Entry { @@ -51,6 +56,7 @@ impl Entry { path: canonical_path, original_path: path.to_path_buf(), is_symlink: metadata.is_symlink(), + last_modified: metadata.modified().ok(), }) } |