mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-14 00:31:33 +10:00
fix(db): initialise doesn't recreate default install dir
This commit is contained in:
@ -190,7 +190,6 @@ pub async fn auth_initiate<'a>() -> Result<(), String> {
|
||||
pub fn setup() -> Result<(AppStatus, Option<User>), ()> {
|
||||
let data = DB.borrow_data().unwrap();
|
||||
|
||||
// If we have certs, exit for now
|
||||
if data.auth.is_some() {
|
||||
let user_result = fetch_user();
|
||||
if user_result.is_err() {
|
||||
|
||||
@ -61,9 +61,6 @@ impl DatabaseImpls for DatabaseInterface {
|
||||
let db_path = data_root_dir.join("drop.db");
|
||||
let games_base_dir = data_root_dir.join("games");
|
||||
|
||||
create_dir_all(data_root_dir.clone()).unwrap();
|
||||
create_dir_all(games_base_dir.clone()).unwrap();
|
||||
|
||||
let default = Database {
|
||||
auth: None,
|
||||
base_url: "".to_string(),
|
||||
@ -75,7 +72,12 @@ impl DatabaseImpls for DatabaseInterface {
|
||||
#[allow(clippy::let_and_return)]
|
||||
let db = match fs::exists(db_path.clone()).unwrap() {
|
||||
true => PathDatabase::load_from_path(db_path).expect("Database loading failed"),
|
||||
false => PathDatabase::create_at_path(db_path, default).unwrap(),
|
||||
false => {
|
||||
create_dir_all(data_root_dir.clone()).unwrap();
|
||||
create_dir_all(games_base_dir.clone()).unwrap();
|
||||
|
||||
PathDatabase::create_at_path(db_path, default).unwrap()
|
||||
}
|
||||
};
|
||||
|
||||
db
|
||||
|
||||
Reference in New Issue
Block a user