Archive: Exe losing icon in program files folder


Exe losing icon in program files folder
Hey there! Newcomer reporting in. :)

I'm making my very first NSIS installer and have come across a frustrating problem I can't seem to overcome.

After installing the data, the installed application's executable's icon is lost. The icon still seems to be there if I look at the properties or try to remove the file, but isn't displayed otherwise. This also expands to the start menu link, and the possible desktop shortcut.

Here is a very trimmed down look at the .nsi (every file, including the application executable, is in data folder):

!include MUI2.nsh
...
!define AppName "Freeze Engine"
!define AppExecutable "Freeze Engine.exe"
!define AppUninstall "Uninstall Freeze Engine.exe"
!define ResourceDir "data"
InstallDir "$PROGRAMFILES\${AppName}"
Var StartMenuFolder
!define SMExecutableLink "${AppName}.lnk"
!define SMUninstallLink "Uninstall ${AppName}.lnk"
...
Section "Install"
SetShellVarContext all
SetOutPath $INSTDIR
File /r ${ResourceDir}\*.*
writeUninstaller "$INSTDIR\${AppUninstall}"

!insertmacro MUI_STARTMENU_WRITE_BEGIN AppName
CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${SMExecutableLink}" "$INSTDIR\${AppExecutable}" \
"" "$INSTDIR\${AppExecutable}" 0
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${SMUninstallLink}" "$INSTDIR\${AppUninstall}" \
"" "$INSTDIR\${AppUninstall}" 0
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
This seems to only happen if I install in the default directory C:\Program Files (x86)\... , installing somewhere else seems to work fine. The uninstaller has no problem regardless of install location (icon added with MUI_UNICON).

While searching, I came across http://forums.winamp.com/showthread.php?t=327806 which seems somewhat similar, but appears to be limited to shortcuts.

Would any friendly person be able to tell what I'm doing wrong? :hang:

Try removing the last 3 arguments of CreateShortCut - you don't need to specify the icon path or index if it is in the target executable.

How big is the target executable?

Stu


Hey, and rather belated thanks for your answer! The target executable is only around 1MB - I was aware of really large exes having some problems.

Anyway, after resetting my computer, all the icons started working just as they were meant to. Maybe it was some windows temp info updating lazily or something?

Thanks for your answer in any case. :)