Skip to main content

apply_unique_target_paths

Function apply_unique_target_paths 

Source
pub fn apply_unique_target_paths(operations: &mut [MatchOperation])
Expand description

Globally enforce unique final target paths across a batch of MatchOperation values.

Run after apply_archive_origin_relocation (and any other post-engine relocation rewrites) so the uniqueness guarantee holds at the actual destination paths — the allocator’s guarantee is about final destinations, not pre-rewrite candidates. The allocator iterates operations sorted by (target_directory, subtitle_file.relative_path) for stability across reruns and probes <base>.<n>.<ext> (preserving any language segment) starting at n = 2 until a free path is found, mutating both new_subtitle_name and relocation_target_path so downstream consumers see consistent values.

See apply_archive_origin_relocation for the required call order.

§Arguments

  • operations - Mutable slice of operations to deduplicate in place.