FEAT: Launch with custom config location
FEAT: Generate banner FEAT: Start blender with banner
This commit is contained in:
+15
-3
@@ -1,5 +1,6 @@
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -50,13 +51,24 @@ fn strip_single_top_level_directory(target_dir: &Path) -> Result<bool, std::io::
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn launch_binary(path: String, args: Vec<String>) -> Result<String, String> {
|
||||
fn launch_binary(
|
||||
path: String,
|
||||
args: Vec<String>,
|
||||
env: Option<HashMap<String, String>>,
|
||||
) -> Result<String, String> {
|
||||
use std::process::{Command, Stdio};
|
||||
Command::new(path)
|
||||
let mut command = Command::new(path);
|
||||
command
|
||||
.args(args)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.stderr(Stdio::null());
|
||||
|
||||
if let Some(env_vars) = env {
|
||||
command.envs(env_vars);
|
||||
}
|
||||
|
||||
command
|
||||
.spawn()
|
||||
.map(|_| "Launched".into())
|
||||
.map_err(|e| e.to_string())
|
||||
|
||||
Reference in New Issue
Block a user