Skip to main content

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

1#![allow(non_snake_case, unused_variables, dead_code, unused_imports)]
2
3//! Wire method `file:exists`. Boolean probe via `tokio::fs::try_exists`.
4
5use serde_json::{Value, json};
6
7use crate::IPC::WindServiceHandlers::Utilities::PathExtraction::extract_path_from_arg;
8
9pub async fn FileExistsNative(Arguments:Vec<Value>) -> Result<Value, String> {
10	let Path = extract_path_from_arg(Arguments.get(0).ok_or("Missing file path")?)?;
11
12	Ok(json!(tokio::fs::try_exists(&Path).await.unwrap_or(false)))
13}