V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tomlee0201
V2EX  ›  Electron

使用 electron 在 Linux 平台上打包的一个问题

  •  
  •   tomlee0201 · 2019-12-16 09:58:32 +08:00 · 4327 次点击
    这是一个创建于 1565 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我们公司使用 electron 开发了一个桌面程序,这个程序需要调用另外一个我们的原生程序完成一些任务。在 win 端没有问题,在 linux 端遇到问题了

    在 linux 上打包时,把这个程序当作资源放到程序目录下。免安装包运行正常,但打成安装包后就有问题,安装包安装在 /opt/myapp 目录下,然后链接符号到 /usr/bin 目录下,但我们的那个辅助程序没有链接符号到 /usr/bin 目录下。这样打开我们的桌面程序就找不到这个辅助程序,如果我手动把链接符号到 /usr/bin 就可以正常使用。

    我找遍了 electron 打包的配置说明,没有看到说可以把资源文件中的可执行文件也添加一个符号,大家有什么建议没

    https://www.electron.build

    reus
        1
    reus  
       2019-12-16 10:24:02 +08:00
    没用过 electron,google 了 "electron get install path",找到 stackoverflow 一个问题: https://stackoverflow.com/questions/37213696/how-can-i-get-the-path-that-the-application-is-running-with-typescript,然后链接到 electron 文档: https://github.com/electron/electron/blob/master/docs/api/app.md#appgetapppath
    这个可能就是指向 /opt/myapp 的

    再搜索 "electron get resource path",找到这个 github issue: https://github.com/electron/electron/issues/1712

    再搜索 "electron get resource binary path",找到这个: https://stackoverflow.com/questions/33152533/bundling-precompiled-binary-into-electron-app

    所以说,会用搜索引擎,解决问题就可以更快。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2814 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 14:52 · PVG 22:52 · LAX 07:52 · JFK 10:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.