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
//! Search if a predefined string exsists in the file of predefined directory
/**
* search_file_directory.c
*
* (C) Copyright 2026 AtlantisOS Project
* by @NachtsternBuild
*
* License: GNU GENERAL PUBLIC LICENSE Version 3
*/
use fs;
use Path;
/// Checks whether a string appears in the name of a file within a directory
/// ### Notes:
/// - Ok(true): File exists
/// - Ok(false): File not exists
/// - Err(e): Error with reading the file
///
/// ### Usage:
///
/// ```rust
/// fn main() {
/// let sources_dir = "./src";
/// let search_string = "helper";
/// match search_file_directory(sources_dir, search_string) {
/// Ok(true) => println!("File!"),
/// Ok(false) => println!("No file."),
/// Err(e) => eprintln!("Error: {}", e),
/// }
/// }
/// ```