tsk-45: Root directory check #66
@@ -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()
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user