From b016bd4387f2c9886ec4216aa604f7ea2eb05d1c Mon Sep 17 00:00:00 2001 From: Aaron Manning Date: Mon, 29 Sep 2025 14:42:07 +1000 Subject: [PATCH] fix root; fix directory creation --- README.md | 2 +- src/sync.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9bb6ec4..9550b4f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Subsequently running the program will check for updates and download any new epi To sync podcasts to a Rockbox iPod, simply run ``` -podcast-hoarder +podcast-hoarder sync ``` replacing `` with the root directory of the iPod. This will generate playlists for all podcasts, sync the playlists to the iPod, and sync the episodes to the iPod. diff --git a/src/sync.rs b/src/sync.rs index 6840b4c..4d61f56 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -162,7 +162,10 @@ pub(crate) fn sync( if !target.exists() { println!("[info] copying from {:?} to {:?}.", source, target); - fs::create_dir_all(target.parent().unwrap())?; + let parent = target.parent().unwrap(); + if !parent.exists() { + fs::create_dir_all(parent)?; + } fs::copy(source, target)?; } }