mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Rewrite guarantee_existence using Path
This commit is contained in:
parent
53234bfa65
commit
7f9a2cf487
1 changed files with 4 additions and 4 deletions
|
@ -25,10 +25,10 @@ def add_extension_if_not_present(file_name: str, extension: str) -> str:
|
|||
return file_name
|
||||
|
||||
|
||||
def guarantee_existence(path: str) -> str:
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
return os.path.abspath(path)
|
||||
def guarantee_existence(path: str | Path) -> Path:
|
||||
path = Path(path)
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
return path.absolute()
|
||||
|
||||
|
||||
def find_file(
|
||||
|
|
Loading…
Add table
Reference in a new issue