scan_lib/
dir_operations.rs1use std::{env, fs};
2
3pub(crate) fn parent_dir() -> String {
4 let mut current_dir: std::path::PathBuf = env::current_dir().unwrap();
5
6 while let Some(parent) = current_dir.parent() {
7 current_dir = parent.to_path_buf();
8 }
9
10 println!("Root directory path: {}", current_dir.display());
11 current_dir.display().to_string()
12}
13
14pub(crate) fn is_dir(path: &String) -> bool {
15 if let Ok(metadata) = fs::metadata(path) {
16 return metadata.is_dir();
17 }
18 false
19}