s-l*_*ndz 9 electron electron-builder
我想更改 Windows 上的安装目录,我的 Electron 应用程序是使用electron-builder.
我尝试将installer.nsh文件放入构建文件夹中,但它仍然相同,它始终安装在默认路径下AppData/Roaming/。
这是我的installer.nsh:
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\CustomPath"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\CustomPath"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\CustomPath"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\CustomPath"
!macroend
Run Code Online (Sandbox Code Playgroud)
有没有人设法使用 Electron-builder 更改默认安装目录?
谢谢你!
For anyone still looking for an answer to this question. Putting the installer.nsh inside the build folder is the first part. The second part, you need to tell the installer to look for it. Under nsis see the last line: "include": "build/installer.nsh"
...
"nsis": {
"allowToChangeInstallationDirectory": true,
"oneClick": false,
"license": "license.html",
"include": "build/installer.nsh"
},
...
Run Code Online (Sandbox Code Playgroud)
That did the trick for me.
| 归档时间: |
|
| 查看次数: |
7338 次 |
| 最近记录: |