Skip to content

Commit 5c8f83a

Browse files
committed
Don't copy the replay file if it already exists
When updating projects, we might end up copying a previous replay file, as it won't be generated again when using `--replay`. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 6accc2a commit 5c8f83a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cookiecutter/hooks/post_gen_project.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ def copy_replay_file() -> None:
116116
"""Copy the replay file to the project root."""
117117
src = _pathlib.Path("~/.cookiecutter_replay/cookiecutter.json").expanduser()
118118
dst = _pathlib.Path(".cookiecutter-replay.json")
119+
120+
if dst.exists():
121+
print(f"Replay file {dst} already exists. Skipping...")
122+
return
123+
119124
if not src.exists():
120125
print(f"WARNING: No replay file found in {src}. Skipping...")
121126

0 commit comments

Comments
 (0)