Skip to main content

scan_paths

Function scan_paths 

Source
pub fn scan_paths(
    source_paths: &[PathBuf],
) -> Result<ScanResult, Box<dyn Error + Send + Sync>>
Expand description

Phase 1 — scan source directories and build a list of ImportCandidates.

Every regular file is a candidate, whatever its extension (SSoT: thumbnails § Media Is Rawshift’s — “every file is kept”). Codec coverage and extension recognition decide grouping and derivatives, never admission: a video, a HEIC, a zero-byte file or a file with an unrecognised or missing extension is backed up byte for byte like a JPEG. The only files left out are the operating system’s own folder metadata (is_os_folder_metadata) and the contents of special directories (.git, DaVinci Resolve), none of which is a user original.

An entry the walk cannot read (a permission-denied directory, a vanished file, a missing source root) is never dropped silently: it becomes a standalone candidate the planner then reports as a SkipError naming the path, so a run that could not see part of its source says so.

Responsibilities:

  • Recursive walkdir traversal, skipping special directories (.git, DaVinci).
  • Live Photo pairing: HEIC with content_identifier XMP field + matching .mov.
  • Filename-stem grouping for RAW/JPEG pairs (delegated to group_by_stem).
  • Standalone files for everything else.