about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sys/nixpkgs/pkgs/ytc/src/downloader.rs5
1 files changed, 5 insertions, 0 deletions
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<PathBuf> {
         .as_file()
         .set_len(0)
         .context("Failed to truncate temp-file")?;
+    if !Into::<PathBuf>::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());