Skip to content

Commit 26528cc

Browse files
committed
fix: attempt to have the paths actually remove
1 parent 78aa60a commit 26528cc

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

hooks/post_gen_project.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import json
33
import shutil
44
import stat
5-
import tempfile
65
from pathlib import Path
76
from typing import Any
87
from typing import Callable
@@ -43,10 +42,6 @@ def remove_undesired_files() -> None:
4342
4443
This is done to avoid issues that tend to arise when the name of the template file contains a conditional.
4544
"""
46-
tmp_dir_root: Path = Path(tempfile.gettempdir()).parent
47-
if Path.cwd().is_relative_to(tmp_dir_root):
48-
return
49-
5045
for path in REMOVE_PATHS:
5146
if path == "":
5247
continue
@@ -55,7 +50,7 @@ def remove_undesired_files() -> None:
5550
if path.is_dir():
5651
shutil.rmtree(path, onerror=remove_readonly)
5752
else:
58-
path.unlink()
53+
path.unlink(missing_ok=True)
5954

6055

6156
def remove_readonly(func: Callable[[str], Any], path: str, _: Any) -> None:

0 commit comments

Comments
 (0)