Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fix video output directory bug

icreiuheciijc8077697fc710
diff --git a/utils/output_directory_getters.py b/utils/output_directory_getters.py
index 14d317fc6..9c1c90f0c 100644
--- a/utils/output_directory_getters.py
+++ b/utils/output_directory_getters.py
@@ -1,6 +1,7 @@
import inspect
import os
+from constants import THIS_DIR
from constants import ANIMATIONS_DIR
@@ -21,11 +22,7 @@ def guarantee_existance(path):
def get_scene_output_directory(scene_class):
file_path = os.path.abspath(inspect.getfile(scene_class))
- # TODO, is there a better way to do this?
- 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 = os.path.relpath(file_path, THIS_DIR)
file_path = file_path.replace(".pyc", "")
file_path = file_path.replace(".py", "")
return guarantee_existance(os.path.join(ANIMATIONS_DIR, file_path))