Added launch prism command

This commit is contained in:
Samuel Walker 2024-06-23 00:49:03 -06:00
parent 216d9b68ee
commit 76b6cac979
2 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,7 @@ fn greet(name: &str) -> String {
fn main() {
prism::install_prism();
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet, modpack::get_modpacks, modpack::launch_modpack])
.invoke_handler(tauri::generate_handler![greet, modpack::get_modpacks, modpack::launch_modpack, prism::launch_prism])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View File

@ -1,9 +1,9 @@
use std::{env, fs::File, io::{BufRead, Cursor, Seek, Write}, path::PathBuf, str::FromStr};
use std::{env, fs::File, io::{BufRead, Cursor, Seek, Write}, path::PathBuf, process::Command, str::FromStr};
use flate2::read::GzDecoder;
use tar::Archive;
use tauri::api::file;
use crate::{ftp, java, system_dirs::get_local_data_directory};
use crate::{ftp, java, system_dirs::{get_local_data_directory, get_prism_executable}};
pub fn check_prism() -> bool {
@ -59,3 +59,10 @@ pub fn install_prism() -> Result<(), Box<dyn std::error::Error>>{
Ok(())
}
#[tauri::command]
pub fn launch_prism() {
let mut child = Command::new(get_local_data_directory().join("prism").join(get_prism_executable())).spawn().unwrap();
}