DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/Navigation/LabelGetBase.rs
1//! Last path segment (filename + extension) of a URI. Used by
2//! the editor tabs and breadcrumbs where only the file's name
3//! is wanted, not its full path.
4
5use serde_json::Value;
6
7pub async fn Fn(Arguments:Vec<Value>) -> Result<Value, String> {
8 let Uri = Arguments
9 .first()
10 .and_then(|V| V.as_str())
11 .ok_or("label:getBase requires uri".to_string())?;
12
13 let Base = Uri.split('/').next_back().unwrap_or(Uri);
14
15 Ok(Value::String(Base.to_owned()))
16}