Collect working copy state for a specific set of paths. This is more efficient than full collection when you already know which paths to check (e.g., from a file watcher). # Arguments `working_copy` - Working copy interface `paths` - Specific paths to check # Returns A `CollectionResult ` for the specified paths. # Example ```rust,ignore let paths = vec!["src/main.rs", "src/lib.
(
working_copy: &W,
paths: I,
)
| 487 | /// let result = collect_working_paths(&working_copy, &paths)?; |
| 488 | /// ``` |
| 489 | pub fn collect_working_paths<'a, W, I>( |
| 490 | working_copy: &W, |
| 491 | paths: I, |
| 492 | ) -> RecordResult<CollectionResult<WorkingFile>> |
| 493 | where |
| 494 | W: WorkingCopyRead, |
| 495 | I: IntoIterator<Item = &'a str>, |
| 496 | { |
| 497 | let mut result = CollectionResult::new(); |
| 498 | |
| 499 | for path in paths { |
| 500 | // Check if file exists |
| 501 | if !working_copy.exists(path) { |
| 502 | continue; |
| 503 | } |
| 504 | |
| 505 | let mut file = WorkingFile::new(path); |
| 506 | |
| 507 | // Check if it's a directory |
| 508 | if working_copy.is_directory(path) { |
| 509 | file = file.as_directory(); |
| 510 | } |
| 511 | |
| 512 | // Try to get mtime |
| 513 | if let Ok(mtime) = working_copy.modified_time(path) { |
| 514 | file = file.with_mtime(mtime); |
| 515 | } |
| 516 | |
| 517 | result.add(file); |
| 518 | } |
| 519 | |
| 520 | Ok(result) |
| 521 | } |
| 522 | |
| 523 | /// Get the pristine state for a single file. |
| 524 | /// |