Files
songparser/src/config.rs
phoenix 8a8f3c1075
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
tsk-45: Root directory check (#66)
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

28 lines
773 B
Rust

#[derive(Default, Debug)]
pub struct App {
pub uri: String,
pub auth_uri: String,
pub token: icarus_models::login_result::LoginResult,
pub root_directory: String,
}
impl App {
pub fn does_root_directory_exists(&self) -> bool {
let path = std::path::Path::new(&self.root_directory);
if path.exists() { path.is_dir() } else { false }
}
}
pub async fn initialize_app_config() -> App {
App {
uri: icarus_envy::environment::get_icarus_base_api_url()
.await
.value,
auth_uri: icarus_envy::environment::get_icarus_auth_base_api_url()
.await
.value,
root_directory: icarus_envy::environment::get_root_directory().await.value,
..Default::default()
}
}