2022-02-12 23:47:23 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2021-01-02 20:47:51 -08:00
|
|
|
import os
|
|
|
|
|
2021-01-15 10:16:37 -10:00
|
|
|
from manimlib.utils.customization import get_customization
|
2022-04-12 19:19:59 +08:00
|
|
|
from manimlib.utils.file_ops import guarantee_existence
|
2021-01-02 20:47:51 -08:00
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_directories() -> dict[str, str]:
|
2021-01-15 10:16:37 -10:00
|
|
|
return get_customization()["directories"]
|
2021-01-02 20:47:51 -08:00
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_temp_dir() -> str:
|
2021-01-06 10:39:34 -08:00
|
|
|
return get_directories()["temporary_storage"]
|
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_tex_dir() -> str:
|
2021-01-06 10:39:34 -08:00
|
|
|
return guarantee_existence(os.path.join(get_temp_dir(), "Tex"))
|
2021-01-02 20:47:51 -08:00
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_text_dir() -> str:
|
2021-01-15 20:18:13 +08:00
|
|
|
return guarantee_existence(os.path.join(get_temp_dir(), "Text"))
|
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_mobject_data_dir() -> str:
|
2021-01-06 10:39:34 -08:00
|
|
|
return guarantee_existence(os.path.join(get_temp_dir(), "mobject_data"))
|
2021-01-02 20:47:51 -08:00
|
|
|
|
2021-03-18 17:33:20 -07:00
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_downloads_dir() -> str:
|
2021-02-03 00:04:30 +05:30
|
|
|
return guarantee_existence(os.path.join(get_temp_dir(), "manim_downloads"))
|
|
|
|
|
2021-01-02 20:47:51 -08:00
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_output_dir() -> str:
|
2021-01-02 20:47:51 -08:00
|
|
|
return guarantee_existence(get_directories()["output"])
|
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_raster_image_dir() -> str:
|
2021-01-02 20:47:51 -08:00
|
|
|
return get_directories()["raster_images"]
|
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_vector_image_dir() -> str:
|
2021-01-02 20:47:51 -08:00
|
|
|
return get_directories()["vector_images"]
|
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_sound_dir() -> str:
|
2021-01-23 11:02:02 -08:00
|
|
|
return get_directories()["sounds"]
|
|
|
|
|
|
|
|
|
2022-02-12 23:47:23 +08:00
|
|
|
def get_shader_dir() -> str:
|
2021-01-02 20:47:51 -08:00
|
|
|
return get_directories()["shaders"]
|