Metadata state management

This commit is contained in:
Jai A
2021-12-15 22:24:08 -07:00
parent 104afe1bb1
commit e9851a8e23
11 changed files with 198 additions and 53 deletions

View File

@@ -5,6 +5,33 @@
#![warn(missing_docs, unused_import_braces, missing_debug_implementations)]
use std::path::Path;
use std::time::Duration;
lazy_static::lazy_static! {
pub static ref LAUNCHER_WORK_DIR: &'static Path = Path::new("./launcher");
}
pub mod launcher;
mod meta;
pub mod modpack;
mod util;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Launcher error: {0}")]
LauncherError(#[from] launcher::LauncherError),
#[error("Modpack error: {0}")]
ModpackError(#[from] modpack::ModpackError),
#[error("Meta error: {0}")]
DaedalusError(#[from] meta::MetaError),
}
pub async fn init() -> Result<(), Error> {
std::fs::create_dir_all(*LAUNCHER_WORK_DIR).expect("Unable to create launcher root directory!");
crate::meta::Metadata::init().await?;
Ok(())
}