electron-egg桌面端应用开机启动中应用路径应该写什么
在electron-egg桌面端应用中,开机启动的应用路径应该写入electron的执行路径,即electron的可执行文件路径。可以通过使用app.getPath('exe')来获取electron的执行路径。
以下是一个示例代码:
const { app } = require('electron');
// 获取electron的执行路径
const exePath = app.getPath('exe');
// 设置开机启动
app.setLoginItemSettings({
openAtLogin: true,
path: exePath,
});
在代码中,exePath为electron的执行路径,然后通过app.setLoginItemSettings方法将应用设置为开机启动。
原文地址: https://www.cveoy.top/t/topic/i6LV 著作权归作者所有。请勿转载和采集!