Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: enhance command functions to include managed binary directory in PATH
Tonho09eb38d9c112
diff --git a/src-tauri/src/core/process.rs b/src-tauri/src/core/process.rsindex c5e76f2a..ddaa77d2 100644--- a/src-tauri/src/core/process.rs+++ b/src-tauri/src/core/process.rs@@ -1,12 +1,28 @@-/// Creates a tokio Command that hides the console window on Windows.+use std::path::PathBuf;++fn managed_bin_dir() -> Option<PathBuf> {+ dirs::data_dir().map(|d| d.join("omniget").join("bin"))+}++fn enhanced_path() -> Option<String> {+ let bin_dir = managed_bin_dir()?;+ let sep = if cfg!(windows) { ";" } else { ":" };+ let current = std::env::var("PATH").unwrap_or_default();+ Some(format!("{}{}{}", bin_dir.display(), sep, current))+}+pub fn command<S: AsRef<std::ffi::OsStr>>(program: S) -> tokio::process::Command {let mut cmd = tokio::process::Command::new(program);#[cfg(target_os = "windows")]cmd.creation_flags(0x08000000);+ if let Some(path) = enhanced_path() {+ cmd.env("PATH", path);+ }+ cmd.env("PYTHONIOENCODING", "utf-8");+ cmd.env("PYTHONUTF8", "1");cmd}-/// Creates a std Command that hides the console window on Windows.pub fn std_command<S: AsRef<std::ffi::OsStr>>(program: S) -> std::process::Command {let mut cmd = std::process::Command::new(program);#[cfg(target_os = "windows")]@@ -14,5 +30,10 @@ pub fn std_command<S: AsRef<std::ffi::OsStr>>(program: S) -> std::process::Commause std::os::windows::process::CommandExt;cmd.creation_flags(0x08000000);}+ if let Some(path) = enhanced_path() {+ cmd.env("PATH", path);+ }+ cmd.env("PYTHONIOENCODING", "utf-8");+ cmd.env("PYTHONUTF8", "1");cmd}