Skip to main content

Mountain/IPC/WindServiceHandlers/UI/
WorkingCopySetDirty.rs

1#![allow(unused_variables)]
2
3//! Wire method: `workingCopy:setDirty`.
4
5use std::sync::Arc;
6
7use serde_json::Value;
8
9use crate::RunTime::ApplicationRunTime::ApplicationRunTime;
10
11pub async fn Fn(RunTime:Arc<ApplicationRunTime>, Arguments:Vec<Value>) -> Result<Value, String> {
12	let Uri = Arguments
13		.first()
14		.and_then(|V| V.as_str())
15		.ok_or("workingCopy:setDirty requires uri".to_string())?;
16
17	let Dirty = Arguments.get(1).and_then(|V| V.as_bool()).unwrap_or(true);
18
19	RunTime.Environment.ApplicationState.Feature.WorkingCopy.SetDirty(Uri, Dirty);
20
21	Ok(Value::Null)
22}