You've already forked AstralRinth
forked from didirus/AstralRinth
Modpack support (#60)
* Modpack support * Finish feature * Tauri errors fix (#61) * async impl * working * fmt and redundancy * moved ? to if let Ok block * Finish modpacks support * remove generated file * fix compile err * fix lint * Fix code review comments + forge support --------- Co-authored-by: Wyatt Verchere <wverchere@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
use dunce::canonicalize;
|
||||
use std::path::Path;
|
||||
use theseus::{prelude::*, profile_create::profile_create};
|
||||
use theseus::prelude::*;
|
||||
use tokio::time::{sleep, Duration};
|
||||
|
||||
// A simple Rust implementation of the authentication run
|
||||
@@ -32,42 +32,23 @@ async fn main() -> theseus::Result<()> {
|
||||
|
||||
// Initialize state
|
||||
let st = State::get().await?;
|
||||
|
||||
// Set max concurrent downloads to 10
|
||||
st.settings.write().await.max_concurrent_downloads = 10;
|
||||
|
||||
// Example variables for simple project case
|
||||
let name = "Example".to_string();
|
||||
let game_version = "1.19.2".to_string();
|
||||
let modloader = ModLoader::Vanilla;
|
||||
let loader_version = "stable".to_string();
|
||||
|
||||
// let icon = Some(
|
||||
// Path::new("../icon_test.png")
|
||||
// .canonicalize()
|
||||
// .expect("Icon could be not be found. If not using, set to None"),
|
||||
// );
|
||||
let icon = None;
|
||||
st.settings.write().await.max_concurrent_downloads = 100;
|
||||
|
||||
// Clear profiles
|
||||
println!("Clearing profiles.");
|
||||
let h = profile::list().await?;
|
||||
for (path, _) in h.into_iter() {
|
||||
profile::remove(&path).await?;
|
||||
{
|
||||
let h = profile::list().await?;
|
||||
for (path, _) in h.into_iter() {
|
||||
profile::remove(&path).await?;
|
||||
}
|
||||
}
|
||||
|
||||
println!("Creating/adding profile.");
|
||||
// Attempt to create a profile. If that fails, try adding one from the same path.
|
||||
// TODO: actually do a nested error check for the correct profile error.
|
||||
let profile_path = profile_create(
|
||||
name.clone(),
|
||||
game_version,
|
||||
modloader,
|
||||
loader_version,
|
||||
icon,
|
||||
)
|
||||
.await?;
|
||||
State::sync().await?;
|
||||
|
||||
let profile_path =
|
||||
pack::install_pack_from_version_id("KxUUUFh5".to_string())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// async closure for testing any desired edits
|
||||
// (ie: changing the java runtime of an added profile)
|
||||
|
||||
Reference in New Issue
Block a user