mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-06-08 07:13:53 +02:00
fix: updater crashes on os.makedirs PermissionError + prune protected dirs
os.makedirs was outside try/except so permission-denied on .github directory creation crashed the entire update. Now both makedirs and copy are caught. Also prunes protected dirs from os.walk so the updater never even enters .github, .git, .claude, etc. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Former-commit-id: d4bdef4604095a82860a4bc91bec3435a878f899
This commit is contained in:
@@ -159,7 +159,10 @@ def _extract_and_copy(zip_path: str, project_root: str, temp_dir: str) -> int:
|
||||
copied = 0
|
||||
skipped = 0
|
||||
|
||||
for root, _dirs, files in os.walk(base):
|
||||
for root, dirs, files in os.walk(base):
|
||||
# Prune protected directories so os.walk never descends into them
|
||||
dirs[:] = [d for d in dirs if d not in _PROTECTED_DIRS]
|
||||
|
||||
for fname in files:
|
||||
src = os.path.join(root, fname)
|
||||
rel = os.path.relpath(src, base).replace("\\", "/")
|
||||
@@ -169,8 +172,8 @@ def _extract_and_copy(zip_path: str, project_root: str, temp_dir: str) -> int:
|
||||
continue
|
||||
|
||||
dst = os.path.join(project_root, rel)
|
||||
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
||||
try:
|
||||
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
||||
shutil.copy2(src, dst)
|
||||
copied += 1
|
||||
except (PermissionError, OSError) as e:
|
||||
|
||||
Reference in New Issue
Block a user