项目改造
This commit is contained in:
@@ -34,10 +34,20 @@ def _equip_icon(equip: dict[str, Any]) -> str:
|
||||
raw = equip.get("path") or ""
|
||||
if not raw:
|
||||
return ""
|
||||
p = basic_path / raw.replace("\\", "/")
|
||||
if not p.exists():
|
||||
return ""
|
||||
return f"<img class='eq-ic' src='{_rel(p)}' alt='' />"
|
||||
rel = raw.replace("\\", "/")
|
||||
# 兼容两种路径存法:插件根相对路径 res/img/...(新/播种数据),
|
||||
# 以及 res/img 目录相对路径 img/...(旧库迁移前遗留),统一找真实文件。
|
||||
candidates = [rel]
|
||||
if rel.startswith("res/"):
|
||||
candidates.append(rel[len("res/"):])
|
||||
else:
|
||||
candidates.append("res/" + rel)
|
||||
candidates.append("res/img/" + rel)
|
||||
for cand in candidates:
|
||||
p = basic_path / cand
|
||||
if p.exists():
|
||||
return f"<img class='eq-ic' src='{_rel(p)}' alt='' />"
|
||||
return ""
|
||||
|
||||
|
||||
def _item_html(equip: dict[str, Any]) -> str:
|
||||
|
||||
Reference in New Issue
Block a user