Files
AstralRinth/theseus/src/lib.rs
Danielle d1070ca213 Initial draft of profile metadata format & CLI (#17)
* Initial draft of profile metadata format

* Remove records, add Clippy to Nix, fix Clippy error

* Work on profile definition

* BREAKING: Make global settings consistent with profile settings

* Add builder methods & format

* Integrate launching with profiles

* Add profile loading

* Launching via profile, API tweaks, and yak shaving

* Incremental update, committing everything due to personal system maintainance

* Prepare for review cycle

* Remove reminents of experimental work

* CLI: allow people to override the non-empty directory check

* Fix mistake in previous commit

* Handle trailing whitespace and newlines in prompts

* Revamp prompt to use dialoguer and support defaults

* Make requested changes
2022-03-28 18:41:35 -07:00

54 lines
1.1 KiB
Rust

//! # Theseus
//!
//! Theseus is a library which provides utilities for launching minecraft, creating Modrinth mod packs,
//! and launching Modrinth mod packs
#![warn(unused_import_braces, missing_debug_implementations)]
static LAUNCHER_WORK_DIR: &'static str = "./launcher";
pub mod data;
pub mod launcher;
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("Data error: {0}")]
DaedalusError(#[from] data::DataError),
}
pub async fn init() -> Result<(), Error> {
std::fs::create_dir_all(LAUNCHER_WORK_DIR)
.expect("Unable to create launcher root directory!");
use crate::data::*;
Metadata::init().await?;
Settings::init().await?;
tokio::try_join! {
launcher::init_download_semaphore(),
Profiles::init(),
}?;
Ok(())
}
pub async fn save() -> Result<(), Error> {
use crate::data::*;
tokio::try_join! {
Settings::save(),
Profiles::save(),
}?;
Ok(())
}