You've already forked AstralRinth
forked from didirus/AstralRinth
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
This commit is contained in:
@@ -22,7 +22,8 @@ impl Metadata {
|
||||
let meta_path = Path::new(LAUNCHER_WORK_DIR).join(META_FILE);
|
||||
|
||||
if meta_path.exists() {
|
||||
let meta_data = std::fs::read_to_string(meta_path).ok()
|
||||
let meta_data = std::fs::read_to_string(meta_path)
|
||||
.ok()
|
||||
.and_then(|x| serde_json::from_str::<Metadata>(&x).ok());
|
||||
|
||||
if let Some(metadata) = meta_data {
|
||||
@@ -77,8 +78,14 @@ impl Metadata {
|
||||
"{}/minecraft/v0/manifest.json",
|
||||
META_URL
|
||||
))),
|
||||
daedalus::modded::fetch_manifest(&format!("{}/forge/v0/manifest.json", META_URL)),
|
||||
daedalus::modded::fetch_manifest(&format!("{}/fabric/v0/manifest.json", META_URL)),
|
||||
daedalus::modded::fetch_manifest(&format!(
|
||||
"{}/forge/v0/manifest.json",
|
||||
META_URL
|
||||
)),
|
||||
daedalus::modded::fetch_manifest(&format!(
|
||||
"{}/fabric/v0/manifest.json",
|
||||
META_URL
|
||||
)),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -90,10 +97,12 @@ impl Metadata {
|
||||
}
|
||||
|
||||
pub async fn get<'a>() -> Result<RwLockReadGuard<'a, Self>, DataError> {
|
||||
Ok(METADATA
|
||||
let res = METADATA
|
||||
.get()
|
||||
.ok_or_else(|| DataError::InitializedError("metadata".to_string()))?
|
||||
.read()
|
||||
.await)
|
||||
.await;
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user