1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Simple checks for the existence of files and directories.
//!
//! This module provides lightweight utilities to determine whether a path
//! exists on the file system and whether it is of the expected type.
/**
* directory_exists.rs
*
* (C) 2026 AtlantisOS Project
* by @NachtsternBuild
*
* License: GNU GENERAL PUBLIC LICENSE Version 3
*/
use Path;
/// Checks whether a path exists and is a directory.
///
/// This function is more restrictive than a simple existence check, as it returns `false`
/// if the path exists but is a regular file.
///
/// # Arguments
/// * `path` - The path to check (accepts `&str`, `String`, `PathBuf`).
///
/// # Usage:
///
/// ```rust
/// fn main() {
/// if directory_exists("/mnt/c/Users") {
/// println!("Directory exists!");
/// }
/// }
/// ```
/// Checks whether a file or directory exists at the specified path.
///
/// Unlike `directory_exists`, this function only checks for
/// physical presence on the disk, regardless of file type.
///
/// # Arguments
/// * `path` - The path to be checked.
///
/// # Usage:
///
/// ```rust
/// Usage:
/// fn main() {
/// if directory_exists("/mnt/c/Users") {
/// println!("Directory exists!");
/// }
/// if file_exists("/etc/config.toml") {
/// println!("File exists!");
/// }
/// }
/// ```