Mountain/IPC/WindServiceHandlers/UI/WorkspacesGetName.rs
1#![allow(unused_variables)]
2
3//! Wire method: `workspaces:getName`.
4
5use std::sync::Arc;
6
7use serde_json::{Value, json};
8
9use crate::RunTime::ApplicationRunTime::ApplicationRunTime;
10
11pub async fn Fn(RunTime:Arc<ApplicationRunTime>) -> Result<Value, String> {
12 let Name = RunTime
13 .Environment
14 .ApplicationState
15 .Workspace
16 .GetWorkspaceFolders()
17 .into_iter()
18 .next()
19 .map(|F| F.GetDisplayName());
20
21 Ok(Name.map(|N| json!(N)).unwrap_or(Value::Null))
22}