tauri_sys::path

Function basename

source
pub async fn basename(path: &str, ext: Option<&str>) -> Result<PathBuf, Error>
Expand description

Returns the last portion of a path. Trailing directory separators are ignored.

@param ext An optional file extension to be removed from the returned path.

ยงExample

use tauri_sys::path::{basename, resolve_resource};

let resource_path = await resolve_resource("app.conf").await?;
let ext = basename(resource_path).await?;
assert_eq!(ext, "app");