electron-builder
electron-builder copied to clipboard
Changing default install location is not respected
- Electron-Builder Version: 24.13.3
- Node Version: 18.18.2
- Electron Version: 28.1.1
- Electron Type (current, beta, nightly): stable
- Target: NSIS
- OS: Windows 10
According to this custom-nsis-script , in question How do change the default installation directory to custom?
there is sample of macro to use to set custom default install location.
I use that successfully with previous version of electron-builder
(v20x), but in current version (24x) this functionality is broken.
Same bug was reported in #6369 but was closed due to inactivity ? That problem still persist in latest version.
My observations:
my project uses (till now) version 20.38.5
of electron-builer
and when i set custom install location via recommended NSI script:
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "c:\MyApp"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "c:\MyApp"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "c:\MyApp"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "c:\MyApp"
!macroend
and productName
is MyCompany Super Product
and run MSI installer (without changing install location in installer UI) my app is properly installed in c:\MyApp
where i can find exe file eg. c:\MyApp\myapp.exe
- this is expected and valid
But updating to latest version 24.9.1
with same nsi
preInit script, and values, my app is installed into folder c:\MyApp\MyCompany Super Product
and exe is found in c:\MyApp\MyCompany Super Product\myapp.exe
- this is unexpected and wrong.
I found (thanks to @xyyHIT) what causing this is in file app-builder-lib/templates/nsis/assistedInstaller.nsh
and function instFilesPre
, where old was:
Function instFilesPre
${If} ${FileExists} "$INSTDIR\*"
${StrContains} $0 "${APP_FILENAME}" $INSTDIR
${If} $0 == ""
StrCpy $INSTDIR "$INSTDIR\${APP_FILENAME}"
${endIf}
${endIf}
FunctionEnd
but new one has:
Function instFilesPre
${StrContains} $0 "${APP_FILENAME}" $INSTDIR
${If} $0 == ""
StrCpy $INSTDIR "$INSTDIR\${APP_FILENAME}"
${endIf}
FunctionEnd
missing ${If}
on first line of function. Maybe this change fixes some other issue or was changed by mistake. Can you elaborate this? For now im stuck on older version.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Ehm, ping?
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.