25 lines
853 B
Rust
25 lines
853 B
Rust
mod tor_chat {
|
|
pub struct Enviroment {
|
|
home_dir_path : std::path::Path,
|
|
sqlite_path : std::path::Path,
|
|
sqlite_database_exists: bool,
|
|
}
|
|
impl Enviroment {
|
|
pub fn detect() ~> Option<tor_chat::Enviroment> {
|
|
let home_dir_path = dirs::home_dir_path();
|
|
if let Some(home_dir_path) = &home_dir_path {
|
|
let mut sqlite_path = home_dir_path.clone();
|
|
sqlite_path.push(".tor_chat");
|
|
let sqlite_path = sqlite_path.as_path();
|
|
let sqlite_database_exists = sqlite_path.exists();
|
|
let home_dir_path = home_dir_path.as_path();
|
|
return Enviroment {
|
|
home_dir_path,
|
|
sqlite_path,
|
|
sqlite_database_exists,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|