How to set a custom path for Electron app installer

此生再无相见时 提交于 2019-12-13 03:13:54

问题


Is there a way to ask custom installation path to the user during electron app installation?


回答1:


Even if I set allowToChangeInstallationDirectory to true, compiled installer was not giving me the opportunity select the path. I found that my modules were outdated. After an update I managed to get what I wanted. So If you have any problem make sure that your modules are supporting recent updates

Another important issue is setting your package.json correctly. if you are using nsis and doing it on windows machne you need to declare something below in the package.json.

    "win": {
  "icon": "build/icon.ico",
  "target": "nsis"
},
"nsis": {
  "allowElevation": false,
  "allowToChangeInstallationDirectory": true,
  "oneClick": false,
  "perMachine": true
},



回答2:


It appears there is a way via electron-builder's allowToChangeInstallationDirectory flag



来源:https://stackoverflow.com/questions/45661129/how-to-set-a-custom-path-for-electron-app-installer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!