You've already forked AstralRinth
forked from didirus/AstralRinth
* initial * more fixes * logs * more fixes * working rescuer * minor log display fix * mac fixes * minor fix * libsselinux1 * linux error * actions test * more bugs. Modpack page! BIG changes * changed minimum 64 -> 8 * removed modpack page moved to modal * removed unnecessary css * mac compile * many revs * Merge colorful logs (#725) * make implementation not dumb * run prettier * null -> true * Add line numbers & make errors more robust. * improvments * changes; virtual scroll --------- Co-authored-by: qtchaos <72168435+qtchaos@users.noreply.github.com> * omorphia colors, comments fix * fixes; _JAVA_OPTIONS * revs * mac specific * more mac * some fixes * quick fix * add java reinstall option --------- Co-authored-by: qtchaos <72168435+qtchaos@users.noreply.github.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me>
47 lines
1.4 KiB
Rust
47 lines
1.4 KiB
Rust
use crate::api::Result;
|
|
use std::path::PathBuf;
|
|
use theseus::prelude::*;
|
|
|
|
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
|
tauri::plugin::Builder::new("profile_create")
|
|
.invoke_handler(tauri::generate_handler![
|
|
profile_create,
|
|
profile_duplicate
|
|
])
|
|
.build()
|
|
}
|
|
|
|
// Creates a profile at the given filepath and adds it to the in-memory state
|
|
// invoke('plugin:profile_create|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: Option<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
|
|
no_watch: Option<bool>,
|
|
) -> Result<ProfilePathId> {
|
|
let res = profile::create::profile_create(
|
|
name,
|
|
game_version,
|
|
modloader,
|
|
loader_version,
|
|
icon,
|
|
None,
|
|
None,
|
|
None,
|
|
no_watch,
|
|
)
|
|
.await?;
|
|
Ok(res)
|
|
}
|
|
|
|
// Creates a profile from a duplicate
|
|
// invoke('plugin:profile_create|profile_duplicate',profile)
|
|
#[tauri::command]
|
|
pub async fn profile_duplicate(path: ProfilePathId) -> Result<ProfilePathId> {
|
|
let res = profile::create::profile_create_from_duplicate(path).await?;
|
|
Ok(res)
|
|
}
|