From 9d766a0b584b36cd77f486b873d4406463dd5b92 Mon Sep 17 00:00:00 2001 From: shenlei Date: Wed, 29 Jul 2026 15:32:45 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9A=AE=E8=82=A4=E5=8C=85=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=BF=BD=E7=95=A5=20=5F=5FMACOSX=20=E5=8F=8A=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS 压缩产生的皮肤 zip 顶层含 __MACOSX 目录,导致解压后判定为 多目录、退回使用解压根目录作 THEME,从而把 __MACOSX 和真实皮肤目录 一并复制进 Images.xcassets。解压统计顶层条目时过滤 __MACOSX 与隐藏 文件,并在 _apply_theme 复制时兜底跳过,使 THEME 正确下钻到真实皮肤 目录。旧皮肤包不含这些条目,行为不变,完全兼容。 Co-Authored-By: Claude Opus 4.8 --- backend/services/build_service.py | 7 ++++++- backend/services/project_patcher.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/services/build_service.py b/backend/services/build_service.py index 92d4f2c..607b4ef 100644 --- a/backend/services/build_service.py +++ b/backend/services/build_service.py @@ -675,7 +675,12 @@ async def generate_config(task_id: str, task, build_dir: Path) -> dict: skin_extract_dir.mkdir(exist_ok=True) with zipfile.ZipFile(skin_zip, "r") as zf: zf.extractall(skin_extract_dir) - entries = list(skin_extract_dir.iterdir()) + # 过滤掉 macOS 压缩产生的 __MACOSX 及隐藏文件,避免把它们 + # 当成皮肤资源目录一起复制进 Images.xcassets。 + entries = [ + e for e in skin_extract_dir.iterdir() + if e.name != "__MACOSX" and not e.name.startswith(".") + ] if len(entries) == 1 and entries[0].is_dir(): config_data["THEME"] = str(entries[0]) else: diff --git a/backend/services/project_patcher.py b/backend/services/project_patcher.py index 47e0c57..2948e2d 100644 --- a/backend/services/project_patcher.py +++ b/backend/services/project_patcher.py @@ -68,6 +68,9 @@ def _apply_theme(build_dir: Path, theme_dir: str, messages: list[str]): for item in source.iterdir(): if not item.is_dir(): continue + # 跳过 macOS 压缩包内的 __MACOSX 及隐藏目录,仅复制真实皮肤资源 + if item.name == "__MACOSX" or item.name.startswith("."): + continue destination = target_assets / item.name if destination.exists(): shutil.rmtree(destination)