Skip to content

Commit 32f3bef

Browse files
committed
fix: adjust generate-demo-project.py to only remove a demo of the same name to avoid some really bad situations with shutil rmtree
1 parent c3f07bb commit 32f3bef

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

scripts/generate-demo-project.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def generate_demo_project(repo_folder: Path, demos_cache_folder: Path, demo_name: str) -> Path:
2020
"""Generates a demo project and returns its root path."""
2121
demos_cache_folder.mkdir(exist_ok=True)
22-
_remove_any_existing_demo(demos_cache_folder)
22+
shutil.rmtree(path=demos_cache_folder / demo_name)
2323
cookiecutter(
2424
template=str(repo_folder),
2525
no_input=True,
@@ -30,12 +30,6 @@ def generate_demo_project(repo_folder: Path, demos_cache_folder: Path, demo_name
3030
return demos_cache_folder / demo_name
3131

3232

33-
def _remove_any_existing_demo(parent_path: Path) -> None:
34-
"""Removes any existing demos."""
35-
for path in parent_path.iterdir():
36-
shutil.rmtree(path)
37-
38-
3933
cli: typer.Typer = typer.Typer()
4034

4135

0 commit comments

Comments
 (0)