From 0d63f060f56192c31f355cc1e959a37bd572c75f Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 6 Jan 2024 15:37:11 +0100 Subject: fix(sys/nixpkgs/pkgs/ytc/scr): Create download dir --- sys/nixpkgs/pkgs/ytc/src/downloader.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/nixpkgs/pkgs') diff --git a/sys/nixpkgs/pkgs/ytc/src/downloader.rs b/sys/nixpkgs/pkgs/ytc/src/downloader.rs index 3b0c6670..f1bbd16a 100644 --- a/sys/nixpkgs/pkgs/ytc/src/downloader.rs +++ b/sys/nixpkgs/pkgs/ytc/src/downloader.rs @@ -1,4 +1,5 @@ use std::{ + fs, io::{stderr, stdout, Read}, mem, path::PathBuf, @@ -117,6 +118,10 @@ fn download_url(url: &str) -> Result { .as_file() .set_len(0) .context("Failed to truncate temp-file")?; + if !Into::::into(DOWNLOAD_DIR).exists() { + fs::create_dir_all(DOWNLOAD_DIR) + .with_context(|| format!("Failed to create download dir at: {}", DOWNLOAD_DIR))? + } let mut yt_dlp = Command::new("yt-dlp"); yt_dlp.current_dir(DOWNLOAD_DIR); yt_dlp.stdout(stdout()); -- cgit 1.4.1