首页 > 解决方案 > 如何访问 electron.app.getPath()?

问题描述

嗨,我正在制作一个自定义组件js/about。我怎样才能getPath()在我的组件中使用它?勇敢的组件似乎可以访问它(通过const {app} = require('electron'))而不需要远程模块。

标签: reactjselectronbrave

解决方案


如果您想从主进程访问它,这就足够了。

const {app} = require('electron');
app.getPath('exe');

但是,如果您从渲染器进程中需要它,请对此进行测试。

const {app} = require('electron').remote;
app.getPath('exe');

推荐阅读