Compare commits

..

1 Commits

Author SHA1 Message Date
8a8f3c1075 tsk-45: Root directory check (#66)
All checks were successful
Rust Build / Check (push) Successful in 36s
Rust Build / Test Suite (push) Successful in 36s
Rust Build / Rustfmt (push) Successful in 29s
Rust Build / Clippy (push) Successful in 36s
Rust Build / build (push) Successful in 42s
Closes #45

Reviewed-on: #66
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-23 20:18:05 +00:00
2 changed files with 2 additions and 6 deletions

View File

@@ -9,11 +9,7 @@ pub struct App {
impl App { impl App {
pub fn does_root_directory_exists(&self) -> bool { pub fn does_root_directory_exists(&self) -> bool {
let path = std::path::Path::new(&self.root_directory); let path = std::path::Path::new(&self.root_directory);
if path.exists() { if path.exists() { path.is_dir() } else { false }
if path.is_dir() { true } else { false }
} else {
false
}
} }
} }

View File

@@ -19,7 +19,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Root directory does not exist"); eprintln!("Root directory does not exist");
println!("Attempting to create directory"); println!("Attempting to create directory");
let path = std::path::Path::new(&app.root_directory); let path = std::path::Path::new(&app.root_directory);
match std::fs::create_dir(&path) { match std::fs::create_dir(path) {
Ok(_) => { Ok(_) => {
println!("Directory created"); println!("Directory created");
} }