Mountain/RPC/CocoonService/GenericRequest/FileSystem/
CreateDir.rs1#![allow(unused_variables, dead_code, unused_imports)]
2
3use serde_json::Value;
4use tonic::Response;
5
6use crate::Vine::Generated::GenericResponse;
7
8pub async fn Fn(RequestId:u64, Params:Value) -> Response<GenericResponse> {
9 let Path = Params
10 .as_str()
11 .or_else(|| Params.get("path").and_then(|V| V.as_str()))
12 .unwrap_or("");
13
14 match tokio::fs::create_dir_all(Path).await {
15 Ok(()) => super::OkResponse(RequestId, &Value::Null),
16
17 Err(Error) => super::ErrResponse(RequestId, -32000, format!("fs.createDir: {}", Error)),
18 }
19}