You've already forked AstralRinth
forked from didirus/AstralRinth
Profile Options (#120)
* init profile settings * more work * finish everything * Switch to index approach * Fix settings str split * Run lint
This commit is contained in:
@@ -9,7 +9,6 @@ use uuid::Uuid;
|
||||
// Remove a profile
|
||||
// invoke('profile_add_path',path)
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_remove(path: &Path) -> Result<()> {
|
||||
profile::remove(path).await?;
|
||||
Ok(())
|
||||
@@ -18,7 +17,6 @@ pub async fn profile_remove(path: &Path) -> Result<()> {
|
||||
// Get a profile by path
|
||||
// invoke('profile_add_path',path)
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_get(
|
||||
path: &Path,
|
||||
clear_projects: Option<bool>,
|
||||
@@ -27,10 +25,18 @@ pub async fn profile_get(
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// Get optimal java version from profile
|
||||
#[tauri::command]
|
||||
pub async fn profile_get_optimal_jre_key(
|
||||
path: &Path,
|
||||
) -> Result<Option<JavaVersion>> {
|
||||
let res = profile::get_optimal_jre_key(path).await?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
// Get a copy of the profile set
|
||||
// invoke('profile_list')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_list(
|
||||
clear_projects: Option<bool>,
|
||||
) -> Result<HashMap<PathBuf, Profile>> {
|
||||
@@ -39,7 +45,6 @@ pub async fn profile_list(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_check_installed(
|
||||
path: &Path,
|
||||
project_id: String,
|
||||
@@ -62,7 +67,6 @@ pub async fn profile_check_installed(
|
||||
/// Installs/Repairs a profile
|
||||
/// invoke('profile_install')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_install(path: &Path) -> Result<()> {
|
||||
profile::install(path).await?;
|
||||
Ok(())
|
||||
@@ -71,7 +75,6 @@ pub async fn profile_install(path: &Path) -> Result<()> {
|
||||
/// Updates all of the profile's projects
|
||||
/// invoke('profile_update_all')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_update_all(
|
||||
path: &Path,
|
||||
) -> Result<HashMap<PathBuf, PathBuf>> {
|
||||
@@ -81,7 +84,6 @@ pub async fn profile_update_all(
|
||||
/// Updates a specified project
|
||||
/// invoke('profile_update_project')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_update_project(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
@@ -92,7 +94,6 @@ pub async fn profile_update_project(
|
||||
// Adds a project to a profile from a version ID
|
||||
// invoke('profile_add_project_from_version')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_add_project_from_version(
|
||||
path: &Path,
|
||||
version_id: String,
|
||||
@@ -103,7 +104,6 @@ pub async fn profile_add_project_from_version(
|
||||
// Adds a project to a profile from a path
|
||||
// invoke('profile_add_project_from_path')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_add_project_from_path(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
@@ -117,7 +117,6 @@ pub async fn profile_add_project_from_path(
|
||||
// Toggles disabling a project from its path
|
||||
// invoke('profile_toggle_disable_project')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_toggle_disable_project(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
@@ -128,7 +127,6 @@ pub async fn profile_toggle_disable_project(
|
||||
// Removes a project from a profile
|
||||
// invoke('profile_remove_project')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_remove_project(
|
||||
path: &Path,
|
||||
project_path: &Path,
|
||||
@@ -141,7 +139,6 @@ pub async fn profile_remove_project(
|
||||
// for the actual Child in the state.
|
||||
// invoke('profile_run', path)
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_run(path: &Path) -> Result<Uuid> {
|
||||
let minecraft_child = profile::run(path).await?;
|
||||
let uuid = minecraft_child.read().await.uuid;
|
||||
@@ -151,7 +148,6 @@ pub async fn profile_run(path: &Path) -> Result<Uuid> {
|
||||
// Run Minecraft using a profile using the default credentials, and wait for the result
|
||||
// invoke('profile_run_wait', path)
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_run_wait(path: &Path) -> Result<()> {
|
||||
let proc_lock = profile::run(path).await?;
|
||||
let mut proc = proc_lock.write().await;
|
||||
@@ -163,7 +159,6 @@ pub async fn profile_run_wait(path: &Path) -> Result<()> {
|
||||
// for the actual Child in the state.
|
||||
// invoke('profile_run_credentials', {path, credentials})')
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_run_credentials(
|
||||
path: &Path,
|
||||
credentials: Credentials,
|
||||
@@ -176,7 +171,6 @@ pub async fn profile_run_credentials(
|
||||
// Run Minecraft using a profile using the chosen credentials, and wait for the result
|
||||
// invoke('profile_run_wait', {path, credentials)
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_run_wait_credentials(
|
||||
path: &Path,
|
||||
credentials: Credentials,
|
||||
@@ -206,7 +200,6 @@ pub struct EditProfileMetadata {
|
||||
// Edits a profile
|
||||
// invoke('profile_edit', {path, editProfile})
|
||||
#[tauri::command]
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn profile_edit(
|
||||
path: &Path,
|
||||
edit_profile: EditProfile,
|
||||
@@ -236,3 +229,14 @@ pub async fn profile_edit(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Edits a profile's icon
|
||||
// invoke('profile_edit_icon')
|
||||
#[tauri::command]
|
||||
pub async fn profile_edit_icon(
|
||||
path: &Path,
|
||||
icon_path: Option<&Path>,
|
||||
) -> Result<()> {
|
||||
profile::edit_icon(path, icon_path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user