Compare commits
No commits in common. "b615c91c10a0485dd795ba37ed9e1f9e9b184d93" and "9e026e8ac7d785ce6cba97b3174218862082e687" have entirely different histories.
b615c91c10
...
9e026e8ac7
@ -31,7 +31,7 @@ fn greet(name: &str) -> String {
|
|||||||
fn main() {
|
fn main() {
|
||||||
prism::install_prism();
|
prism::install_prism();
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.invoke_handler(tauri::generate_handler![greet, modpack::get_modpacks, modpack::launch_modpack])
|
.invoke_handler(tauri::generate_handler![greet, modpack::get_modpacks])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
use crate::ftp;
|
use crate::ftp;
|
||||||
use crate::system_dirs::{get_local_data_directory, get_prism_executable};
|
use crate::system_dirs::get_local_data_directory;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::process::Command;
|
|
||||||
use std::{io::Cursor, path::PathBuf};
|
use std::{io::Cursor, path::PathBuf};
|
||||||
use std::io::{Read, Seek};
|
use std::io::{Read, Seek};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
@ -59,9 +58,7 @@ fn check_modpack_needs_update(id: String) -> bool{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn launch_modpack(id: String){
|
pub fn launch_modpack(id: String){
|
||||||
|
|
||||||
if check_modpack_needs_update(id.clone()) {
|
if check_modpack_needs_update(id.clone()) {
|
||||||
install_modpack(id.clone());
|
install_modpack(id.clone());
|
||||||
}
|
}
|
||||||
@ -69,12 +66,7 @@ pub fn launch_modpack(id: String){
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn install_modpack(id: String){
|
fn install_modpack(id: String){
|
||||||
let versions = get_versions(id.clone());
|
let mut file = File::create(env::temp_dir().join(format!("{}.mrpack", get_modpack_name(id)))).unwrap();
|
||||||
let path = env::temp_dir().join(format!("{}.mrpack", get_modpack_name(id.clone())));
|
|
||||||
let mut file = File::create(path.clone()).unwrap();
|
|
||||||
ftp::ftp_retr(PathBuf::new().join(id).join(versions[versions.len()-1].version.clone()), file, |_| return);
|
|
||||||
let child = Command::new(get_local_data_directory().join("prism").join(get_prism_executable())).arg("-I").arg(path).spawn().unwrap();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
Loading…
Reference in New Issue
Block a user