From ff947b57a8a09b6693aaa70cccf4d9f18f863992 Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Thu, 5 Mar 2026 22:36:47 +0100 Subject: [PATCH] Fix std::os::unix included on Windows where it doesnt exist, and remove set permission in yt-dlp for anything other than unix altogether. --- src/yt_dlp.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/yt_dlp.rs b/src/yt_dlp.rs index 457598a..4642d12 100644 --- a/src/yt_dlp.rs +++ b/src/yt_dlp.rs @@ -1,7 +1,10 @@ -use std::{env::current_dir, fs::{File, exists}, io, os::unix::fs::PermissionsExt, process::Command}; +use std::{env::current_dir, fs::{File, exists}, io, process::Command}; use reqwest; use rfd::{MessageButtons, MessageDialog, MessageDialogResult}; +#[cfg(unix)] +use std::os::unix::fs::PermissionsExt; + pub fn get_yt_dlp_path() -> String { if cfg!(target_os = "windows"){ current_dir().expect("Failed to get current working directory").join("bin").join("yt-dlp.exe").to_string_lossy().to_string() @@ -40,6 +43,8 @@ pub fn check_and_download_yt_dlp() { let mut body = reqwest::blocking::get(url).expect("Could not download yt-dlp"); let mut out = File::create(get_yt_dlp_path()).expect("failed to create file"); io::copy(&mut body, &mut out).expect("failed to copy content"); + + #[cfg(unix)] out.set_permissions(PermissionsExt::from_mode(0o755)); }