Skip to main content

Mountain/IPC/WindServiceHandlers/Navigation/
LabelGetBase.rs

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