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 any post-engine relocation rewrites (e.g. match_command.rs archive-origin forced relocation) so the uniqueness guarantee holds at the actual destination paths. 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.

ยงArguments

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