open game programs in seperate thread

This commit is contained in:
SpikeHD
2022-05-21 19:37:41 -07:00
parent 6e8f8dbdca
commit 2385f572d3

View File

@@ -1,17 +1,16 @@
use std::thread;
use tauri;
use open;
#[tauri::command]
pub fn run_program(path: String) {
// Open the program from the specified path.
// match open::that(path) {
// Ok(_) => (),
// Err(e) => println!("Failed to open program: {}", e),
// };
match open::with(format!("/c \"{}\"", &path), "C:\\Windows\\System32\\cmd.exe") {
Ok(_) => (),
Err(e) => println!("Failed to open program: {}", e),
};
// Open in new thread to prevent blocking
thread::spawn(move || {
open::that(&path).unwrap();
});
}
#[tauri::command]