Skip to content

Commit

Permalink
Changed manim downloads location from default to custom_default config
Browse files Browse the repository at this point in the history
  • Loading branch information
sahilmakhijani committed Feb 2, 2021
1 parent 46309e2 commit 3263236
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions manimlib/utils/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
6 changes: 2 additions & 4 deletions manimlib/utils/file_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import validators
import urllib.request
import tempfile


def add_extension_if_not_present(file_name, extension):
Expand All @@ -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
Expand Down

0 comments on commit 3263236

Please sign in to comment.