Files
AstralRinth/theseus_gui/src-tauri/src/api/profile_create.rs
Geometrically b9a3a6dc11 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>
2023-04-05 19:04:09 -07:00

35 lines
1.1 KiB
Rust

use crate::api::Result;
use std::path::PathBuf;
use theseus::prelude::*;
// Generic basic profile creation tool.
// Creates an essentially empty dummy profile with profile_create
#[tauri::command]
pub async fn profile_create_empty() -> Result<PathBuf> {
let res = profile_create::profile_create_empty().await?;
State::sync().await?;
Ok(res)
}
// Creates a profile at the given filepath and adds it to the in-memory state
// invoke('profile_add',profile)
#[tauri::command]
pub async fn profile_create(
name: String, // the name of the profile, and relative path
game_version: String, // the game version of the profile
modloader: ModLoader, // the modloader to use
loader_version: String, // the modloader version to use, set to "latest", "stable", or the ID of your chosen loader
icon: Option<PathBuf>, // the icon for the profile
) -> Result<PathBuf> {
let res = profile_create::profile_create(
name,
game_version,
modloader,
Some(loader_version),
icon,
None,
)
.await?;
Ok(res)
}