Function glory_cli::ext::append_str_to_filename
source · pub fn append_str_to_filename(
path: &Utf8PathBuf,
suffix: &str
) -> Result<Utf8PathBuf>Expand description
Extension Safe &str Append
Arguments
path- Current path to filesuffix- &str to be appened before extension
Example
use camino::Utf8PathBuf;
use glory_cli::ext::append_str_to_filename;
let path: Utf8PathBuf = "foo.bar".into();
assert_eq!(append_str_to_filename(&path, "_bazz").unwrap().as_str(), "foo_bazz.bar");
let path: Utf8PathBuf = "a".into();
assert_eq!(append_str_to_filename(&path, "b").unwrap().as_str(), "ab");