diff options
| author | A Farzat <a@farzat.xyz> | 2026-03-08 11:25:30 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2026-03-08 11:25:30 +0300 |
| commit | 7c72d848131dbfcef47663bc6dd3e7c87225b7e4 (patch) | |
| tree | 8dca6f2d50cc91668e78e5d5eadee0096fa5e8d1 /src/epub.rs | |
| parent | a44aad5889bcd85d7bdd0be9c54f9111da917cf5 (diff) | |
| download | oreilly-epub-7c72d848131dbfcef47663bc6dd3e7c87225b7e4.tar.gz oreilly-epub-7c72d848131dbfcef47663bc6dd3e7c87225b7e4.zip | |
Use XDG directories to map downloads
This provides standard locations for files regardless of the location of
the binary and/or the working directory.
Could allow some customization in the future, both as a permanent config
or one-time case.
Diffstat (limited to 'src/epub.rs')
| -rw-r--r-- | src/epub.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/epub.rs b/src/epub.rs index 79ac11e..4f31784 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -74,6 +74,9 @@ pub fn create_epub_archive( file_entries: &[FileEntry], chapters: &HashMap<String, Chapter>, ) -> Result<()> { + if let Some(parent_dir) = output_epub.parent() { + std::fs::create_dir_all(parent_dir)?; + } let out_file = std::fs::File::create(output_epub)?; let mut zip = ZipWriter::new(out_file); |
