A community-maintained Python framework for creating mathematical animations.
Always expand user when validating file-paths (#2885)
ad-chaos7a801707b6dc
diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.pyindex ec838a7a1..c87eae705 100644--- a/manim/mobject/svg/svg_mobject.py+++ b/manim/mobject/svg/svg_mobject.py@@ -125,8 +125,8 @@ class SVGMobject(VMobject, metaclass=ConvertToOpenGL):if self.file_name is None:raise Exception("Must specify file for SVGMobject")- if self.file_name.exists():- self.file_path = self.file_name+ if self.file_name.expanduser().exists():+ self.file_path = self.file_name.expanduser()returnrelative = Path.cwd() / self.file_namediff --git a/manim/mobject/text/code_mobject.py b/manim/mobject/text/code_mobject.pyindex e39cecadb..229274be0 100644--- a/manim/mobject/text/code_mobject.py+++ b/manim/mobject/text/code_mobject.py@@ -285,7 +285,7 @@ class Code(VGroup):raise Exception("Must specify file for Code")possible_paths = [os.path.join(os.path.join("assets", "codes"), self.file_name),- self.file_name,+ os.path.expanduser(self.file_name),]for path in possible_paths:if os.path.exists(path):diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.pyindex 1f41837d6..3cddd1559 100644--- a/manim/utils/file_ops.py+++ b/manim/utils/file_ops.py@@ -161,7 +161,7 @@ def guarantee_empty_existence(path: Path) -> Path:def seek_full_path_from_defaults(file_name: str, default_dir: Path, extensions: list[str]) -> Path:- possible_paths = [Path(file_name)]+ possible_paths = [Path(file_name).expanduser()]possible_paths += [Path(default_dir) / f"{file_name}{extension}" for extension in ["", *extensions]]