Electron-builder: Change installation directory when not using 'oneClick' with NSIS

Created on 18 Jul 2016  ·  15Comments  ·  Source: electron-userland/electron-builder

electron-builder version

  • 5.12.1

Building for

  • windows nsis x64

Building on

  • linux x64(Ubuntu 16.04)

Assuming 'oneClick' is set to false for NSIS, and two package.json scheme is used with the development package.json having the build object as follows -

"build": {
    "appId": "com.somerandom.name",
    "productName": "RandomName",
    "asar":false,
    "win": {
      "target": "nsis",
      "title": "TitleValue",
      "version": "1.0.0",
      "authors": "User Name"
    },
    "nsis":{
      "oneClick": false
    }
  }

The Installation directory(tested with Windows 10) defaults to

C:\Users\usernameAppData\Local\Programs\appname

How can the user be allowed to change the installation directory ?

feature nsis

Most helpful comment

+1
I think it's common sense for allowing users to choose where to install.

All 15 comments

If you want to install for all users, set perMachine to true. Or do you want to allow user to install to any location?

+1 For this one. Allowing user to install to a custom location.

It is easy to do, will be implemented soon. But! Think twice — are you sure that your users will be more happy with boring installer instead of one-click (and without admin rights requirement)?

The default path works fine with one-click installs, it makes sense.This issue only applies if one-click install is not required.

For such cases I want the user to be able to install to any location. If the user is an Administrator he should be allowed to choose the path suitable for his system configuration.

@develar
You're right, but I can foresee that my users might request such a level of control (where to install).

+1
I think it's common sense for allowing users to choose where to install.

Is this possible to achieve using an include script?

@domachine Yes. But if you are able to make such change, it is better to send pull request.

@develar Ok, I'd happily send a pull-request. I'm just a little bit overwhelmed with this complex NSIS config. Currently figuring out the proper location to insert the !insertmacro MUI_PAGE_DIRECTORY statement. Would customInit be the right place?

OK, nope 😄 . The following include errors:

!macro customInit
  !insertmacro MUI_PAGE_DIRECTORY
!macroend

@domachine You need to write completely different NSIS script — script. Sorry for false info.

Or change https://github.com/electron-userland/electron-builder/blob/master/templates/nsis/boringInstaller.nsh and send PR (probably another files should be modified as well).

@develar No problem. Do you have any hints on the template location where it might make sense to include such an option? Currently I'm hacking here https://github.com/electron-userland/electron-builder/blob/7ea3d62e837df0ae3c33b2a0dfe831964e077129/templates/nsis/boringInstaller.nsh#L28. As soon as I get somethin' working, I'll open a pull-request.

Edit: Ah, I see your updated answer. Thx for the information 👍

Fixed in 11.1.0.

Thanks to all for the awesome new feature !

But now, we have a boring installer even for updates, am i wrong ?
How can I fix it in this idea :

    "nsisWeb": {
      "oneClick": "isUpdated",
      "perMachine": true,
      "allowToChangeInstallationDirectory": true
    },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JohnWeisz picture JohnWeisz  ·  3Comments

philcockfield picture philcockfield  ·  3Comments

popod picture popod  ·  3Comments

NPellet picture NPellet  ·  3Comments

antonycourtney picture antonycourtney  ·  3Comments