Would it be possible to use a NSIS script instead of waiting for a mapping of the (many) options NSIS has?
For example, I'd need a way to register a custom scheme during the installation phase on Windows.
Ability to pass own nsis script? Will be implemented.
Exactly. It would be very useful.
Can you predict approximately when this feature will be added?
Can you predict approximately when this feature will be added?
1-4 days.
how do you register a custom scheme with nsis btw, @giacgbj? (sorry, offtopic!)
@atypicalprogrammer You have to write a registry entry according to https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx following these samples http://nsis.sourceforge.net/Reading_and_Writing_the_Registry_-_NSIS_makes_it_easy .
Upvoting this to the max. I have to ship a 3rd party installer along with my app. With _electron-boilerplate_ I was able to use a custom NSIS script to run the 3rd party installer from within the NSIS installer.
We don't yet support specifying custom script, but allows you to customise without a headache.
As I don't have time to finish docs yet, draft here:
build/installer.nsh.customHeader, customInit, customUnInit, customInstall, customUnInstall.Example:
``` nsis
!macro customHeader
!system "echo '' > ${BUILD_RESOURCES_DIR}/customHeader"
!macroend
!macro customInit
!system "echo '' > ${BUILD_RESOURCES_DIR}/customInit"
!macroend
!macro customInstall
!system "echo '' > ${BUILD_RESOURCES_DIR}/customInstall"
!macroend
```
BUILD_RESOURCES_DIR and PROJECT_DIR defined for you.build is added as addincludedir for you (i.e. you don't need to use BUILD_RESOURCES_DIR to include subfiles).Pre-release version will be in a hour.
I tried following the instructions develar gave above, but it didn't work for me. See: https://github.com/electron-userland/electron-builder/issues/623#issuecomment-242521219
Update: Apparently URL schemes in windows only work on perMachine: true apps.
@Joshua-Smith : I set perMachine : true and nsh script still not writing register key after installation process !!
!macro customInstall
DetailPrint "Register test URI Handler"
DeleteRegKey HKCR "test"
WriteRegStr HKCR "test" "" "URL:test"
WriteRegStr HKCR "test" "URL Protocol" ""
WriteRegStr HKCR "test\shell" "" ""
WriteRegStr HKCR "test\shell\Open" "" ""
WriteRegStr HKCR "test\shell\Open\command" "" "$INSTDIR\${APP_EXECUTABLE_FILENAME} %1"
!macroend
`{
"name": "electron app",
"productName": "electronapp",
"version": "0.1.0",
"author": "me",
"description": "electron app test",
"main": "main.js",
"devDependencies": {
"electron-builder": "^20.28.3",
"electron-packager": "^12.1.1",
"electron-winstaller": "^2.6.4",
"electron": "^1.8.8"
},
"build": {
"appId": "fr.digitalberry.berryagent",
"win": {
"target": "nsis",
"icon": "build/icon.ico"
}
},
"scripts": {
"start": "electron .",
"dist": "build",
"test": "echo \"Error: no test specified\" && exit 1",
},
"dependencies": {
},
"nsis": {
"oneClick" : false ,
"allowToChangeInstallationDirectory": true,
"include" : "build/script.nsh" ,
"perMachine" : true
}
}
`
My installer.nsh is pretty much just like yours, except I have line breaks. I assume that's just a formatting glitch here. It's working for me, but I'm on a very, very old version of electron-builder because it's working just fine for me and I've had no reason to update. Try putting a syntax error into the installer.nsh file and see if it's actually reading it.
@mrjoshuaesmith
Thank you for your attention , what version of electron builder do you use ?
I鈥檓 all the way back at 6.7.7
Most helpful comment
We don't yet support specifying custom script, but allows you to customise without a headache.
As I don't have time to finish docs yet, draft here:
build/installer.nsh.customHeader,customInit,customUnInit,customInstall,customUnInstall.Example:
``` nsis
!macro customHeader
!system "echo '' > ${BUILD_RESOURCES_DIR}/customHeader"
!macroend
!macro customInit
!system "echo '' > ${BUILD_RESOURCES_DIR}/customInit"
!macroend
!macro customInstall
!system "echo '' > ${BUILD_RESOURCES_DIR}/customInstall"
!macroend
```
BUILD_RESOURCES_DIRandPROJECT_DIRdefined for you.buildis added asaddincludedirfor you (i.e. you don't need to useBUILD_RESOURCES_DIRto include subfiles).Pre-release version will be in a hour.