mirror of
https://github.com/csd4ni3l/soundboard.git
synced 2026-03-10 09:09:24 +01:00
Fix std::os::unix included on Windows where it doesnt exist, and remove set permission in yt-dlp for anything other than unix altogether.
This commit is contained in:
@@ -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));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user