Mod Management API (#81)

* Profile mod management

* remove print statement
This commit is contained in:
Geometrically
2023-04-13 12:03:15 -07:00
committed by GitHub
parent bb126c0545
commit f8173d3b78
22 changed files with 616 additions and 252 deletions

View File

@@ -27,6 +27,51 @@ pub async fn profile_list(
Ok(res)
}
// Adds a project to a profile from a version ID
// invoke('profile_add_project_from_version')
#[tauri::command]
pub async fn profile_add_project_from_version(
path: &Path,
version_id: String,
) -> Result<PathBuf> {
let res = profile::add_project_from_version(path, version_id).await?;
Ok(res)
}
// Adds a project to a profile from a path
// invoke('profile_add_project_from_path')
#[tauri::command]
pub async fn profile_add_project_from_path(
path: &Path,
project_path: &Path,
project_type: Option<String>,
) -> Result<PathBuf> {
let res = profile::add_project_from_path(path, project_path, project_type)
.await?;
Ok(res)
}
// Toggles disabling a project from its path
// invoke('profile_toggle_disable_project')
#[tauri::command]
pub async fn profile_toggle_disable_project(
path: &Path,
project_path: &Path,
) -> Result<()> {
profile::toggle_disable_project(path, project_path).await?;
Ok(())
}
// Removes a project from a profile
// invoke('profile_remove_project')
#[tauri::command]
pub async fn profile_remove_project(
path: &Path,
project_path: &Path,
) -> Result<()> {
profile::remove_project(path, project_path).await?;
Ok(())
}
// Run minecraft using a profile using the default credentials
// Returns a u32 representing the PID, which can be used to poll
// for the actual Child in the state.