Skip to main content

resolve_unique_filename

Function resolve_unique_filename 

Source
pub fn resolve_unique_filename(dir: &Path, name: &str) -> PathBuf
Expand description

Resolve a unique filename in dir, appending -1, -2, etc. on collision.

If dir/name doesn’t exist, returns it as-is. Otherwise increments a counter on the stem: photo.jpgphoto-1.jpgphoto-2.jpg