fix(windows): hide engine consoles

Disable the native Windows frame at startup and render in-app window controls so packaged builds use Firelink's own titlebar placement instead of the default OS chrome.

Apply CREATE_NO_WINDOW to raw child processes used by the aria2 daemon and shared engine version checks. Route ffmpeg and deno checks through the same hidden version-check helper so Settings > Engine does not flash console windows.

Normalize Windows extended-length paths before returning approved download roots to the UI, while keeping canonicalization for backend safety checks. Detect yt-dlp's embedded runtime per platform so Windows onedir builds look for python*.dll instead of macOS Python.framework.

Verification: npm run build; cargo check --manifest-path src-tauri/Cargo.toml; cargo test --manifest-path src-tauri/Cargo.toml --lib; node --check scripts/smoke-packaged-app.js; Ruby YAML parse for .github/workflows/release.yml; git diff --check.
This commit is contained in:
NimBold
2026-06-30 15:47:02 +03:30
parent 1d9b898e9c
commit 35ccd5659e
5 changed files with 207 additions and 54 deletions
+44
View File
@@ -39,6 +39,50 @@ pub fn engine_binary_name(engine: &str) -> String {
format!("{engine}-{}{}", target_triple(), executable_suffix())
}
#[cfg(target_os = "windows")]
const CREATE_NO_WINDOW: u32 = 0x08000000;
pub fn hide_child_console(command: &mut std::process::Command) {
#[cfg(target_os = "windows")]
{
use std::os::windows::process::CommandExt;
command.creation_flags(CREATE_NO_WINDOW);
}
#[cfg(not(target_os = "windows"))]
{
let _ = command;
}
}
pub fn hide_tokio_child_console(command: &mut tokio::process::Command) {
#[cfg(target_os = "windows")]
{
command.creation_flags(CREATE_NO_WINDOW);
}
#[cfg(not(target_os = "windows"))]
{
let _ = command;
}
}
pub fn display_path(path: &Path) -> String {
let text = path.to_string_lossy();
#[cfg(target_os = "windows")]
{
if let Some(stripped) = text.strip_prefix(r"\\?\UNC\") {
return format!(r"\\{stripped}");
}
if let Some(stripped) = text.strip_prefix(r"\\?\") {
return stripped.to_string();
}
}
text.to_string()
}
pub fn trusted_system_path() -> Result<OsString, String> {
let entries = trusted_system_path_entries();
std::env::join_paths(entries)