Skip to content

Commit 225a114

Browse files
committed
delete existing dir before copying
1 parent 8ad899a commit 225a114

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/mirror_and_fix_spm_sources.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ def checkedFile(path):
3333
proj_dir = os.getenv("PROJECT_DIR")
3434
print(f"PROJECT_DIR: {proj_dir}")
3535

36-
# verify src/dest dirs
36+
# verify src dirs
3737
sources_dir = checkedDir(os.path.join(proj_dir, "JDStatusBarNotification"))
3838
swift_source = checkedFile(os.path.join(sources_dir, "Public/NotificationPresenter.swift"))
39-
spm_mirror_dir_name = "spm_sources"
40-
spm_mirror_dir = checkedDir(os.path.join(proj_dir, spm_mirror_dir_name))
4139

4240
# copy to dest dir
41+
spm_mirror_dir_name = "spm_sources"
42+
spm_mirror_dir = os.path.join(proj_dir, spm_mirror_dir_name)
43+
44+
if os.path.isdir(spm_mirror_dir):
45+
print(f"Deleting existing copies.")
46+
shutil.rmtree(spm_mirror_dir)
47+
os.mkdir(spm_mirror_dir)
48+
4349
print(f"Copying sources to: {spm_mirror_dir_name}")
4450
shutil.copytree(sources_dir, spm_mirror_dir, dirs_exist_ok=True)
4551

0 commit comments

Comments
 (0)