Skip to main content

create_default_output_path

Function create_default_output_path 

Source
pub fn create_default_output_path(input: &Path) -> PathBuf
Expand description

Creates a default output path by appending _synced to the file stem.

§Arguments

  • input - The input subtitle path

§Returns

The input path with its file name replaced by <stem>_synced.<extension>, or the input path unchanged when it has no file stem or no extension.

§Examples

use std::path::PathBuf;
use subx_core::core::sync::create_default_output_path;

assert_eq!(
    create_default_output_path(&PathBuf::from("subs/movie.srt")),
    PathBuf::from("subs/movie_synced.srt")
);
assert_eq!(
    create_default_output_path(&PathBuf::from("noextension")),
    PathBuf::from("noextension")
);