jeff_hanna
12th August 2005 15:24 UTC
Start Menu Icons only made if I rename the start menu folder. Why?
If I use the "Choose Start Menu Folder" option page my start menu icons will never show up unless I specifically change the name of the start menu folder on that page. If I leave it at the installer provided default the start menu folder will be made but no shortcuts will be created within it.
I've attached a sample .nsi file that shows the problem:
Brummelchen
12th August 2005 15:27 UTC
NSI is missing...
jeff_hanna
12th August 2005 15:27 UTC
Here's the file. It didn't get attached to my original post for some reason.
Afrow UK
12th August 2005 15:50 UTC
Page defines go before inserting the MUI_PAGE macro's:
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Test"
#!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
#!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
#!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
The reason it's not working currently is because the default start menu folder is set to the Name of your installer which is:
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
${PRODUCT_NAME} is "Start Menu Test" and ${PRODUCT_VERSION} is "", therefore your name will be "Start Menu Test ".
Now with that folder name in the path, it won't work because e.g.
$SMPROGRAMS\Start Menu Test \shortcut.lnk is an invalid path (got that space in there before the \) hence why it is not working.
-Stu
jeff_hanna
12th August 2005 16:38 UTC
Excellent! Thanks, Stu.
jeff_hanna
12th August 2005 19:04 UTC
Eh. Not so excellent, it seems.
I still get a space in the name if the one of the uninstall defines is uncommented.
!define PRODUCT_NAME "Start Menu Test"
!define PRODUCT_VERSION ""
!define PRODUCT_PUBLISHER ""
!define PRODUCT_WEB_SITE "http://www.mythicentertainment.com/"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "Sections.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-r.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall-r.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Start Menu Test"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
#!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Start menu page
var STARTMENU_FOLDER
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
;etc...
If I uncomment '#!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"' I get a space at the end of the name. If I leave that define commented then the uninstaller doesn't remove the start menu folder.
How do I get this to work and have an uninstaller for my app?
jeff_hanna
12th August 2005 19:39 UTC
Never mind. Found it. I still had a "${PRODUCT_VERSION}" in the Post section WriteRegStr. The unistall code was reading that and putting that spurious space at the end of the directory name.