fix some ui and trying to fix black window
This commit is contained in:
@@ -5,6 +5,8 @@ use tauri::AppHandle;
|
||||
use anyhow::{Result, anyhow};
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::os::windows::process::CommandExt;
|
||||
use zip::ZipArchive;
|
||||
use std::io::Cursor;
|
||||
|
||||
@@ -104,9 +106,13 @@ pub async fn update_ytdlp(app: &AppHandle) -> Result<String> {
|
||||
}
|
||||
|
||||
// Use built-in update for yt-dlp
|
||||
let output = std::process::Command::new(&path)
|
||||
.arg("-U")
|
||||
.output()?;
|
||||
let mut cmd = std::process::Command::new(&path);
|
||||
cmd.arg("-U");
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
let output = cmd.output()?;
|
||||
|
||||
if !output.status.success() {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
|
||||
@@ -127,9 +133,13 @@ pub fn get_ytdlp_version(app: &AppHandle) -> Result<String> {
|
||||
return Ok("未安装".to_string());
|
||||
}
|
||||
|
||||
let output = std::process::Command::new(&path)
|
||||
.arg("--version")
|
||||
.output()?;
|
||||
let mut cmd = std::process::Command::new(&path);
|
||||
cmd.arg("--version");
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
let output = cmd.output()?;
|
||||
|
||||
if output.status.success() {
|
||||
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
|
||||
|
||||
@@ -66,6 +66,8 @@ pub async fn fetch_metadata(app: &AppHandle, url: &str, parse_mix_playlist: bool
|
||||
let qjs_path = binary_manager::get_qjs_path(app)?; // Get absolute path to quickjs
|
||||
|
||||
let mut cmd = Command::new(ytdlp_path);
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
// Pass the runtime and its absolute path to --js-runtimes
|
||||
cmd.arg("--js-runtimes").arg(format!("quickjs:{}", qjs_path.to_string_lossy()));
|
||||
@@ -200,6 +202,8 @@ pub async fn download_video(
|
||||
}).ok();
|
||||
|
||||
let mut cmd = Command::new(ytdlp_path);
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
let mut child = cmd
|
||||
.args(&args)
|
||||
|
||||
Reference in New Issue
Block a user