mirror of
https://github.com/3b1b/manim.git
synced 2025-08-19 13:01:00 +00:00
Fix video output directory bug
This commit is contained in:
parent
31478c523c
commit
8077697fc7
1 changed files with 2 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from constants import THIS_DIR
|
||||||
from constants import ANIMATIONS_DIR
|
from constants import ANIMATIONS_DIR
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,11 +22,7 @@ def guarantee_existance(path):
|
||||||
def get_scene_output_directory(scene_class):
|
def get_scene_output_directory(scene_class):
|
||||||
file_path = os.path.abspath(inspect.getfile(scene_class))
|
file_path = os.path.abspath(inspect.getfile(scene_class))
|
||||||
|
|
||||||
# TODO, is there a better way to do this?
|
file_path = os.path.relpath(file_path, THIS_DIR)
|
||||||
parts = file_path.split(os.path.sep)
|
|
||||||
if "manim" in parts:
|
|
||||||
sub_parts = parts[parts.index("manim") + 1:]
|
|
||||||
file_path = os.path.join(*sub_parts)
|
|
||||||
file_path = file_path.replace(".pyc", "")
|
file_path = file_path.replace(".pyc", "")
|
||||||
file_path = file_path.replace(".py", "")
|
file_path = file_path.replace(".py", "")
|
||||||
return guarantee_existance(os.path.join(ANIMATIONS_DIR, file_path))
|
return guarantee_existance(os.path.join(ANIMATIONS_DIR, file_path))
|
||||||
|
|
Loading…
Add table
Reference in a new issue