diff --git a/src/backup/database.rs b/src/backup/database.rs index 3a06a24..966b71c 100644 --- a/src/backup/database.rs +++ b/src/backup/database.rs @@ -66,6 +66,13 @@ pub fn retrieve_db(paths: &Paths, token: &String) -> Result<(), String> { .send() { Ok(r) => { + // Just make sure ~/.indi exists + match std::fs::create_dir(format!("{}/{}", paths.home_path, ".indi")) { + Ok(_) => (), + Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (), + Err(e) => panic!("IO error: {}", e), + }; + let mut f = File::create("temp_backup.tar").unwrap(); f.write_all(r.as_bytes()).unwrap(); let mut arch = Archive::new(File::open("temp_backup.tar").unwrap()); diff --git a/src/lib.rs b/src/lib.rs index 3625baa..ccf5b68 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ pub struct CliArgs { pub struct Paths { folder_path: String, logs_path: String, - home_path: String, + pub home_path: String, db_path: String, indi_conf_path: String, }