fix root; fix directory creation

This commit is contained in:
Aaron Manning
2025-09-29 14:42:07 +10:00
parent 7ce0ae5830
commit b016bd4387
2 changed files with 5 additions and 2 deletions

View File

@@ -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 To sync podcasts to a Rockbox iPod, simply run
``` ```
podcast-hoarder <ipod-root> podcast-hoarder sync <ipod-root>
``` ```
replacing `<ipod-root>` 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. replacing `<ipod-root>` 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.

View File

@@ -162,7 +162,10 @@ pub(crate) fn sync(
if !target.exists() { if !target.exists() {
println!("[info] copying from {:?} to {:?}.", source, target); 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)?; fs::copy(source, target)?;
} }
} }