本文介绍了如何检测到Electron应用程序首次运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用最新版本的Electron-builder(使用AutoUpadate)开发应用程序.
I'm developing an App using the latest version of Electron-builder (using AutoUpadate).
是否有任何方法可以知道该应用在安装后首次运行?
Is there any way to know that the App is running for the first time after installation?
Ps:我曾尝试使用electron-config,但是卸载后用户数据文件不会被删除,并且每次安装都需要做一些事情(即使它在同一台机器上).
Ps: I have tried using electron-config but the user data files are not deleted after uninstall, and I needed to do some things with every installation (even if it's on the same machine).
推荐答案
检查squirrel-firstrun标志:
Check for the squirrel-firstrun flag:
var cmd = process.argv[1];
if (cmd == '--squirrel-firstrun') {
// Running for the first time.
}
(您无需安装任何程序即可工作)
(you don't need to install anything for this to work)
这篇关于如何检测到Electron应用程序首次运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!