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