From b6c688292af29826ca772ed30c62e82678e3dd6c Mon Sep 17 00:00:00 2001 From: doylet Date: Wed, 21 Feb 2024 17:36:41 +1100 Subject: [PATCH] Simplify cleanup step of installation --- win_portable_msvc.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/win_portable_msvc.py b/win_portable_msvc.py index 9dc8d88..ac7fc14 100644 --- a/win_portable_msvc.py +++ b/win_portable_msvc.py @@ -328,13 +328,11 @@ if install_msvc: if install_sdk: redist_dir = OUTPUT / "Windows Kits/10/Redist" redist_versioned_dir = redist_dir / f'{sdkv}' - - if not os.path.exists(redist_versioned_dir): - os.makedirs(redist_versioned_dir) + shutil.rmtree(redist_versioned_dir, ignore_errors=True) + redist_versioned_dir.mkdir(exist_ok=True) for file_name in os.listdir(redist_dir): if not file_name.startswith('10.0.'): # Simple heuristic - shutil.rmtree(redist_versioned_dir, ignore_errors=True) shutil.move((redist_dir / file_name), redist_versioned_dir) ### cleanup