I've creating an NSIS package and noticed that when a program is installed to the legacy 32-bit folder on 64-bit Windows 7 Ultimate SP1, that "C:\Program Files (x86)" is being translated either by NSIS or Windows to the environmental variable "%ProgramFiles%" which resolves to the 64-bit version of Program Files. Where I'm running into a problem is with CreateShortcut and the custom icon setting. Here's my code for starters:
Quote:
CreateShortcut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\online.exe" "" "$INSTDIR\online.exe" "" "" "" "Launches PSOBB"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Visit schtserv.com.lnk" "http://www.schtserv.com/" "" "$INSTDIR\online.exe" "" "" "" "Visit the SCHTHACK website"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Register a game account.lnk" "http://www.schtserv.com/bbregister.php" "" "$INSTDIR\online.exe" "" "" "" "You need an account to play PSOBB"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Community forums and support.lnk" "http://schtserv.com/forum/" "" "$INSTDIR\online.exe" "" "" "" "Join the community"
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Readme.txt.lnk" "$INSTDIR\readme.txt" "" "" 0 "" "" "o_o"
|
Now if I install the program anywhere inside "C:\Program Files (x86)" and inspect the shortcuts above (right-click->Properties), and choose "Change Icon" it will prompt an error that says "Windows cannot find the file %ProgramFiles%\<installfolder>\online.exe." I did a test and found that if I placed a copy of online.exe in the 64-bit Program Files folder that the shortcut icon was found by Windows Explorer, and I did another test and found that the field was properly filled in if any folder other than C:\Program Files (x86) (such as C:\newtest) was used. What I think is NSIS has some type of code that is converting Program Files path by default to the environmental variable %ProgramFiles%. This might work on 32-bit Windows, but 64-bit Windows uses different folders for 32-bit and 64-bit and this causes the icon path at least for CreateShortcut to be resolved improperly in Windows Explorer (64-bit version).
What I also found is that in some cases the icon on the shortcuts will default back to the missing shortcut icon and you have to reset the icon manually on the shortcut for it to work again, which is how I discovered this problem. It does this every time after a reboot on the first shortcut in the code, the other ones are a bit different (URLs/Internet shortcuts) that don't seem to reset as often (so far). I'm still trying to fix this problem but thought I'd report about my findings, it's obviously a bug that needs fixing somewhere.
NSIS 2.46...