Compiler improvements (#145)

* Initial bug fixes

* fix compile error on non-mac

* Fix even more bugs

* Fix more

* fix more

* fix build

* fix build

* working basic

* removed zip

* working functions

* merge fixes

* fixed loadintg bar bug

* changed to one layer deep

* forge version numbers

* improvements + refactoring

* renamed things to fit plugin

* fixed bugs

* removed println

* overrides dont include mrpack

* merge

* fixes

* fixes

* fixed deletion

* merge errors

* force sync before export

* removed testing

* missed line

* removed console log

* mac error reverted

* incoreclty named helper

* added to new register method

* review changes

* minor changes

* moved create pack

* renamed function

---------

Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Wyatt Verchere
2023-06-28 09:58:58 -07:00
committed by GitHub
parent 47970d932b
commit f52e777379
38 changed files with 1047 additions and 896 deletions

View File

@@ -6,8 +6,35 @@ use std::path::{Path, PathBuf};
use theseus::prelude::*;
use uuid::Uuid;
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
tauri::plugin::Builder::new("profile")
.invoke_handler(tauri::generate_handler![
profile_remove,
profile_get,
profile_get_optimal_jre_key,
profile_list,
profile_check_installed,
profile_install,
profile_update_all,
profile_update_project,
profile_add_project_from_version,
profile_add_project_from_path,
profile_toggle_disable_project,
profile_remove_project,
profile_run,
profile_run_wait,
profile_run_credentials,
profile_run_wait_credentials,
profile_edit,
profile_edit_icon,
profile_export_mrpack,
profile_get_potential_override_folders,
])
.build()
}
// Remove a profile
// invoke('profile_add_path',path)
// invoke('plugin:profile|profile_add_path',path)
#[tauri::command]
pub async fn profile_remove(path: &Path) -> Result<()> {
profile::remove(path).await?;
@@ -15,7 +42,7 @@ pub async fn profile_remove(path: &Path) -> Result<()> {
}
// Get a profile by path
// invoke('profile_add_path',path)
// invoke('plugin:profile|profile_add_path',path)
#[tauri::command]
pub async fn profile_get(
path: &Path,
@@ -35,7 +62,7 @@ pub async fn profile_get_optimal_jre_key(
}
// Get a copy of the profile set
// invoke('profile_list')
// invoke('plugin:profile|profile_list')
#[tauri::command]
pub async fn profile_list(
clear_projects: Option<bool>,
@@ -65,7 +92,7 @@ pub async fn profile_check_installed(
}
/// Installs/Repairs a profile
/// invoke('profile_install')
/// invoke('plugin:profile|profile_install')
#[tauri::command]
pub async fn profile_install(path: &Path) -> Result<()> {
profile::install(path).await?;
@@ -73,7 +100,7 @@ pub async fn profile_install(path: &Path) -> Result<()> {
}
/// Updates all of the profile's projects
/// invoke('profile_update_all')
/// invoke('plugin:profile|profile_update_all')
#[tauri::command]
pub async fn profile_update_all(
path: &Path,
@@ -82,7 +109,7 @@ pub async fn profile_update_all(
}
/// Updates a specified project
/// invoke('profile_update_project')
/// invoke('plugin:profile|profile_update_project')
#[tauri::command]
pub async fn profile_update_project(
path: &Path,
@@ -92,7 +119,7 @@ pub async fn profile_update_project(
}
// Adds a project to a profile from a version ID
// invoke('profile_add_project_from_version')
// invoke('plugin:profile|profile_add_project_from_version')
#[tauri::command]
pub async fn profile_add_project_from_version(
path: &Path,
@@ -102,7 +129,7 @@ pub async fn profile_add_project_from_version(
}
// Adds a project to a profile from a path
// invoke('profile_add_project_from_path')
// invoke('plugin:profile|profile_add_project_from_path')
#[tauri::command]
pub async fn profile_add_project_from_path(
path: &Path,
@@ -115,7 +142,7 @@ pub async fn profile_add_project_from_path(
}
// Toggles disabling a project from its path
// invoke('profile_toggle_disable_project')
// invoke('plugin:profile|profile_toggle_disable_project')
#[tauri::command]
pub async fn profile_toggle_disable_project(
path: &Path,
@@ -125,7 +152,7 @@ pub async fn profile_toggle_disable_project(
}
// Removes a project from a profile
// invoke('profile_remove_project')
// invoke('plugin:profile|profile_remove_project')
#[tauri::command]
pub async fn profile_remove_project(
path: &Path,
@@ -173,7 +200,7 @@ pub async fn profile_get_potential_override_folders(
// Run minecraft using a profile using the default credentials
// Returns the UUID, which can be used to poll
// for the actual Child in the state.
// invoke('profile_run', path)
// invoke('plugin:profile|profile_run', path)
#[tauri::command]
pub async fn profile_run(path: &Path) -> Result<Uuid> {
let minecraft_child = profile::run(path).await?;
@@ -182,7 +209,7 @@ 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)
// invoke('plugin:profile|profile_run_wait', path)
#[tauri::command]
pub async fn profile_run_wait(path: &Path) -> Result<()> {
let proc_lock = profile::run(path).await?;
@@ -193,7 +220,7 @@ pub async fn profile_run_wait(path: &Path) -> Result<()> {
// Run Minecraft using a profile using chosen credentials
// Returns the UUID, which can be used to poll
// for the actual Child in the state.
// invoke('profile_run_credentials', {path, credentials})')
// invoke('plugin:profile|profile_run_credentials', {path, credentials})')
#[tauri::command]
pub async fn profile_run_credentials(
path: &Path,
@@ -205,7 +232,7 @@ 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)
// invoke('plugin:profile|profile_run_wait', {path, credentials)
#[tauri::command]
pub async fn profile_run_wait_credentials(
path: &Path,
@@ -235,7 +262,7 @@ pub struct EditProfileMetadata {
}
// Edits a profile
// invoke('profile_edit', {path, editProfile})
// invoke('plugin:profile|profile_edit', {path, editProfile})
#[tauri::command]
pub async fn profile_edit(
path: &Path,
@@ -275,7 +302,7 @@ pub async fn profile_edit(
}
// Edits a profile's icon
// invoke('profile_edit_icon')
// invoke('plugin:profile|profile_edit_icon')
#[tauri::command]
pub async fn profile_edit_icon(
path: &Path,