Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions manim_slides/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ def convert_to(self, dest: Path) -> None:
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())

Expand Down Expand Up @@ -434,6 +436,8 @@ def read_image_from_video_file(file: Path, frame_index: FrameIndex) -> Image:
read_image_from_video_file(slide_config.file, self.frame_index)
)

dest.parent.mkdir(parents=True, exist_ok=True)

images[0].save(
dest,
"PDF",
Expand Down Expand Up @@ -524,6 +528,7 @@ def save_first_image_from_video_file(file: Path) -> Optional[str]:
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)


Expand Down
Loading