Skip to main content

Mountain/IPC/WindServiceHandlers/FileSystem/Native/
FileMkdirNative.rs

1#![allow(non_snake_case, unused_variables, dead_code, unused_imports)]
2
3//! Wire method `file:mkdir`. `create_dir_all` is recursive; matches the
4//! Electron default VS Code expects.
5
6use serde_json::Value;
7
8use crate::IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg;
9
10pub async fn FileMkdirNative(Arguments:Vec<Value>) -> Result<Value, String> {
11	let Path = extract_path_from_arg(Arguments.get(0).ok_or("Missing directory path")?)?;
12
13	tokio::fs::create_dir_all(&Path)
14		.await
15		.map_err(|E| format!("Failed to mkdir: {} ({})", Path, E))?;
16
17	Ok(Value::Null)
18}