tsk-45: Root directory check #66

Merged
phoenix merged 5 commits from tsk-45 into main 2025-10-23 20:18:06 +00:00
2 changed files with 3 additions and 10 deletions
Showing only changes of commit c79a2cf98e - Show all commits

View File

@@ -3,25 +3,20 @@ pub struct App {
pub uri: String, pub uri: String,
pub auth_uri: String, pub auth_uri: String,
pub token: icarus_models::login_result::LoginResult, pub token: icarus_models::login_result::LoginResult,
pub root_directory: String pub root_directory: String,
} }
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() {
if path.is_dir() { if path.is_dir() { true } else { false }
true
} else {
false
}
} else { } else {
false false
} }
} }
} }
pub async fn initialize_app_config() -> App { pub async fn initialize_app_config() -> App {
App { App {
uri: icarus_envy::environment::get_icarus_base_api_url() uri: icarus_envy::environment::get_icarus_base_api_url()

View File

@@ -31,9 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
app.token = match auth::get_token(&app).await { app.token = match auth::get_token(&app).await {
Ok(login_result) => { Ok(login_result) => login_result,
login_result
}
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); eprintln!("Error: {err:?}");
std::process::exit(-1); std::process::exit(-1);