Skip to content

品牌素材下载功能失败:proma-logos 目录未加入打包配置 #177

@ericheroster

Description

@ericheroster

问题描述

在「设置 → 机器人 → 品牌素材」页面,点击任意 Logo 的「下载」按钮,均提示「保存失败,请重试」。

根因分析

定位到问题出在 apps/electron/src/main/ipc.tsSAVE_RESOURCE_FILE_AS handler(第 522-559 行):

const resourcesDir = normalize(join(__dirname, 'resources'))
const fullPath = normalize(join(resourcesDir, resourceRelativePath))
// resourceRelativePath 例:proma-logos/proma-black.png

if (!existsSync(fullPath)) {
  throw new Error(`Resource not found: ${resourceRelativePath}`)
}

代码从 dist/main/resources/proma-logos/ 下读取图片文件。但 electron-builder.ymlextraResources 配置中没有包含 resources/proma-logos 目录,导致打包后安装包里根本没有这些 Logo 图片,existsSync 返回 false,最终抛出异常。

复现步骤

  1. 打开 Proma 应用
  2. 进入「设置 → 机器人 → 品牌素材」
  3. 点击任意 Logo(经典黑、纯白版等)的下载按钮
  4. 看到 toast 提示「保存失败,请重试」

修复方案

apps/electron/electron-builder.ymlextraResources 中添加:

# Proma 品牌 Logo 素材(品牌素材下载功能使用)
- from: resources/proma-logos
  to: proma-logos
  filter:
    - "**/*"

环境信息

  • Proma 版本:v0.8.1(源码最新 main 分支)
  • 平台:Windows
  • 打包工具:electron-builder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions