mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 15:44:35 +01:00
Install CA certificate
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
use std::thread;
|
||||
use std::process::Command;
|
||||
use tauri;
|
||||
use open;
|
||||
|
||||
@@ -7,12 +8,31 @@ use open;
|
||||
pub fn run_program(path: String) {
|
||||
// Open the program from the specified path.
|
||||
|
||||
// Open in new thread to prevent blocking
|
||||
// Open in new thread to prevent blocking.
|
||||
thread::spawn(move || {
|
||||
open::that(&path).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn run_command(command: String) -> String {
|
||||
// Run the specified command.
|
||||
let output = if cfg!(target_os = "windows") {
|
||||
Command::new("cmd")
|
||||
.args(["/C", command])
|
||||
.output()
|
||||
.expect("failed to execute process")
|
||||
} else {
|
||||
Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(command)
|
||||
.output()
|
||||
.expect("failed to execute process")
|
||||
};
|
||||
|
||||
output.stdout.to_string()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn run_jar(path: String, execute_in: String, java_path: String) {
|
||||
let command = if java_path.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user