reactjs - 如何访问 electron.app.getPath()?
问题描述
嗨,我正在制作一个自定义组件js/about
。我怎样才能getPath()
在我的组件中使用它?勇敢的组件似乎可以访问它(通过const {app} = require('electron')
)而不需要远程模块。
解决方案
如果您想从主进程访问它,这就足够了。
const {app} = require('electron');
app.getPath('exe');
但是,如果您从渲染器进程中需要它,请对此进行测试。
const {app} = require('electron').remote;
app.getPath('exe');
推荐阅读
- python - 添加写作摘要“张量”对象没有属性“值”时出现Tensorflow错误
- swift - 如何让 NSWindows 应用我的自定义颜色?
- drupal - 如何在基于文本的 Drupal 8 中将列表连接到另一个列表?
- ios - UILabel 设置 onClick
- excel - 如何使用 VBA 将数据从 SAP 复制到 Excel?
- swagger - “nelmio_api_doc”下无法识别的选项“sandbox, swagger”。可用选项是“区域”、“文档”、“模型”
- php - 无法使用 nginx 加载 php 页面 - 502 Bad gateway
- c# - No data is sent from form to action
- javascript - jquery的ready方法和加载函数
- c# - 如何在 JObject 中检测和显示对象的所有关键元素?