Skip to content

Commit 9a0bb30

Browse files
committed
Added check to ensure the current user has permissions to delete Xcode versions
The `verify_permissions()` function checks that it has permissions to install Xcode, not to delete old versions.
1 parent acc6ee8 commit 9a0bb30

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

xcode-update.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def delete_xcode(dry_run: bool):
9090
xcode_version_to_delete = oldest_xcode_version(include_releases=should_delete_release_version)
9191
if xcode_version_to_delete:
9292
print(f'- {xcode_version_to_delete} will be deleted.')
93+
if not os.access(xcode_version_to_delete, os.R_OK | os.W_OK):
94+
raise PermissionError(f"The current user doesn't have permissions to delete {xcode_version_to_delete}")
9395

9496
if not dry_run:
9597
shutil.rmtree(str(xcode_version_to_delete))

0 commit comments

Comments
 (0)