MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / snapshot

Function snapshot

atomic-cli/tests/it/diagnostics_integration_test.rs:1307–1326  ·  view source on GitHub ↗

Every file under `root` with its length and modification time.

(root: &Path)

Source from the content-addressed store, hash-verified

1305
1306/// Every file under `root` with its length and modification time.
1307fn snapshot(root: &Path) -> Vec<(String, u64, std::time::SystemTime)> {
1308 let mut entries = Vec::new();
1309 let mut stack = vec![root.to_path_buf()];
1310 while let Some(dir) = stack.pop() {
1311 for entry in std::fs::read_dir(&dir).unwrap().flatten() {
1312 let meta = entry.metadata().unwrap();
1313 if meta.is_dir() {
1314 stack.push(entry.path());
1315 } else {
1316 entries.push((
1317 entry.path().display().to_string(),
1318 meta.len(),
1319 meta.modified().unwrap(),
1320 ));
1321 }
1322 }
1323 }
1324 entries.sort();
1325 entries
1326}

Calls 9

is_dirMethod · 0.80
displayMethod · 0.80
sortMethod · 0.80
unwrapMethod · 0.45
metadataMethod · 0.45
pushMethod · 0.45
pathMethod · 0.45
lenMethod · 0.45
modifiedMethod · 0.45

Tested by

no test coverage detected