I would like to change the install directory on Windows, my Electron App is built with electron-builder
.
I've tried putting a installer.nsh
file inside the build folder, but it's still the same, it always installs under the default path AppData/Roaming/
.
This is my 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
Has anyone managed to change the default install directory with electron-builder?
Thank you!
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"
},
...
That did the trick for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With