fix(cli/convert): ensure dest path can be written (#262)

Fixes the issue that non-existing parent(s) in the dest path would raise an error.
This commit is contained in:
Jérome Eertmans
2023-09-15 11:29:30 +02:00
committed by GitHub
parent bbe8b96030
commit 6272d3f7ec
2 changed files with 8 additions and 0 deletions

View File

@ -65,6 +65,9 @@ In an effort to better document changes, this CHANGELOG document is now created.
[#253](https://github.com/jeertmans/manim-slides/discussions/253), caused by
Python 3.11's change in how `Enum` work.
[#257](https://github.com/jeertmans/manim-slides/pull/257).
- Fixed potential non-existing parent path issue in
`manim convert`'s destination path.
[#262](https://github.com/jeertmans/manim-slides/pull/262)
### Removed

View File

@ -378,6 +378,8 @@ class RevealJS(Converter):
for presentation_config in self.presentation_configs:
presentation_config.copy_to(full_assets_dir)
dest.parent.mkdir(parents=True, exist_ok=True)
with open(dest, "w") as f:
revealjs_template = Template(self.load_template())
@ -434,6 +436,8 @@ class PDF(Converter):
read_image_from_video_file(slide_config.file, self.frame_index)
)
dest.parent.mkdir(parents=True, exist_ok=True)
images[0].save(
dest,
"PDF",
@ -524,6 +528,7 @@ class PowerPoint(Converter):
if self.auto_play_media:
auto_play_media(movie, loop=slide_config.is_loop())
dest.parent.mkdir(parents=True, exist_ok=True)
prs.save(dest)