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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Automated creation of directory structures.
//!
//! This module provides functions to ensure that paths exist.
//! It handles the recursive creation of parent directories, both for
//! pure directory paths and for paths that point to files.
/**
* make_path.rs
*
* (C) Copyright 2026 AtlantisOS Project
* by @NachtsternBuild
*
* License: GNU GENERAL PUBLIC LICENSE Version 3
*/
use Path;
use io;
use fs;
/// Creates a directory and all missing parent directories (recursively).
///
/// This function operates in “fire-and-forget” mode and logs success or
/// errors directly to the console.
///
/// # Arguments
/// * `path` - The path to be created (accepts `&str`, `String`, `Path`, etc.).
///
/// # Usage:
///
/// ```rust
/// fn main() {
/// create_directory("/tmp/atlantis/logs/sys");
/// }
/// ```
/// Creates a path recursively and returns the result of the operation.
///
/// Unlike `create_directory`, there is no automatic logging here;
/// error handling is the responsibility of the caller.
///
/// # Return value
/// An [io::Result<()>] that confirms the success of the operation or describes the IO error.
///
/// # Usage:
///
/// ```rust
/// fn main() {
/// make_path("/tmp/atlantis/logs/sys");
/// }
/// ```
/// Extracts the parent directory of a file path and creates it recursively.
///
/// This function is ideal when you have the path to a file (e.g., a config file)
/// and want to ensure that the folder where the file should be located exists.
///
/// # Arguments
/// * `filepath` - The full path to the file.
///
/// # Usage:
///
/// ```rust
/// fn main() {
/// let target = "/tmp/atlantis/config/settings.toml";
/// if let Err(e) = make_path_dirname(target) {
/// eprintln!("Error: {}", e);
/// } else {
/// println!("Parent-Directory {:?} are ready.", target);
/// }
/// }
/// ```