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

Legacy re-export. create_default_output_path now lives in subx_core::core::sync; prefer that path. The alias exists so that consumers of subx_cli::cli::sync_args::create_default_output_path keep compiling across the subx-core split and will be removed once they have migrated. In-crate callers reference the core path directly. 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")
);