mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-05 17:56:53 +01:00
open game programs in seperate thread
This commit is contained in:
@@ -1,17 +1,16 @@
|
|||||||
|
|
||||||
|
use std::thread;
|
||||||
use tauri;
|
use tauri;
|
||||||
use open;
|
use open;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn run_program(path: String) {
|
pub fn run_program(path: String) {
|
||||||
// Open the program from the specified path.
|
// Open the program from the specified path.
|
||||||
// match open::that(path) {
|
|
||||||
// Ok(_) => (),
|
// Open in new thread to prevent blocking
|
||||||
// Err(e) => println!("Failed to open program: {}", e),
|
thread::spawn(move || {
|
||||||
// };
|
open::that(&path).unwrap();
|
||||||
match open::with(format!("/c \"{}\"", &path), "C:\\Windows\\System32\\cmd.exe") {
|
});
|
||||||
Ok(_) => (),
|
|
||||||
Err(e) => println!("Failed to open program: {}", e),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|||||||
Reference in New Issue
Block a user