From 32632367b6fa9a8cbfe818f74a815251e2aecb70 Mon Sep 17 00:00:00 2001 From: Sahil Makhijani Date: Wed, 3 Feb 2021 00:04:30 +0530 Subject: [PATCH] Changed manim downloads location from default to custom_default config --- manimlib/utils/directories.py | 3 +++ manimlib/utils/file_ops.py | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/manimlib/utils/directories.py b/manimlib/utils/directories.py index e5629140..dfc9aaec 100644 --- a/manimlib/utils/directories.py +++ b/manimlib/utils/directories.py @@ -23,6 +23,9 @@ def get_text_dir(): def get_mobject_data_dir(): return guarantee_existence(os.path.join(get_temp_dir(), "mobject_data")) +def get_downloads_dir(): + return guarantee_existence(os.path.join(get_temp_dir(), "manim_downloads")) + def get_output_dir(): return guarantee_existence(get_directories()["output"]) diff --git a/manimlib/utils/file_ops.py b/manimlib/utils/file_ops.py index 761bf039..75587761 100644 --- a/manimlib/utils/file_ops.py +++ b/manimlib/utils/file_ops.py @@ -3,7 +3,6 @@ import numpy as np import validators import urllib.request -import tempfile def add_extension_if_not_present(file_name, extension): @@ -24,10 +23,9 @@ def find_file(file_name, directories=None, extensions=None): # Check if this is a file online first, and if so, download # it to a temporary directory if validators.url(file_name): + from manimlib.utils.directories import get_downloads_dir stem, name = os.path.split(file_name) - folder = guarantee_existence( - os.path.join(tempfile.gettempdir(), "manim_downloads") - ) + folder = get_downloads_dir() path = os.path.join(folder, name) urllib.request.urlretrieve(file_name, path) return path