|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 | |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
problem with icons, CreateShortcut on 64-bit Windows and "C:\Program Files (x86)"
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:
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... |
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
Removed public display of stupid...
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
These are shortcuts being installed to the Start Menu Programs folder, ala internal NSIS Constant $SMPROGRAMS. I also found that it makes no difference what InstallDir is, the user can change directories to C:\Program Files (x86) during the installation, or manually select C:\Program Files (x86) and it will convert the shortcut icon path to %ProgramFiles%. As I said I believe NSIS detects "C:\Program Files (x86)" in $INSTDIR and converts it to %ProgramFiles%... unless it is some internal calls of Windows doing it (which NSIS executes), which is definitely possible.
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
Edit, scratch part of what I said before.
This was my InstallDir: InstallDir "$PROGRAMFILES32\${APP_NAME}" I changed it to InstallDir "C:\PSOBB-installer\${APP_NAME}" Rebuild... Actually, I'll just post my entire script for you to test with some test files. I think the behavior I described with %ProgramFiles% variable only occurs if $PROGRAMFILES is initially used in InstallDir, this doesn't happen after changing InstallDir like I did above, and then manually select "C:\Program Files (x86)" as the installation location. Here's my script & test files to make it work if you wanna take a look and try it: http://strags.com/d2/nsis.zip |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
Kodama,
PHP Code:
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
Did you check the Change Icon function to determine if the path was set correctly? Didn't work on Win7Ult x64.. BUT the icon does show up properly, at least right after install. Problem I have run into, is that it might default back to the broken shortcut icon after awhile, which shows up on the next screen.
http://strags.com/i/myapp.png ![]() http://strags.com/i/myapp2.png
|
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
If I go and put a copy of online.exe (for your example) in C:\Program Files\My App, it will find it without changing the shortcut. It won't work ever without being manually updated if it's in C:\Program Files (x86) under these exact circumstances. I used the same code as you...
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
AH! not I see the problem... I'm going to perform some tests to see what can be done about this.
|
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
Let me know what you find...
|
|
|
|
|
|
#10 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
NSIS does not touch your strings, blame the windows shortcut API. At least for you main apps shortcut, try not setting the icon directly and just use "" as the icon path
Edit: Another option would be to remove the SLDF_HAS_EXP_ICON_SZ flag and datablock after the shortcut has been created: PHP Code:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
As usual... Awesome work Anders
I Wrapped your code up into a function/macro for easy implementation so I can add it to my own packages. I have been packaging for 64bit XP for some time but never noticed the issue. Worse yet no one has complained yet. ![]() PHP Code:
|
|
|
|
|
|
#12 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
FYI: Wiki Article Created
|
|
|
|
|
|
#13 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
That URL in the comment is broken. You should probably point to: http://forums.winamp.com/showthread.php?t=327806
|
|
|
|
|
|
#14 | |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
Quote:
|
|
|
|
|
|
|
#15 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
|
|
|
|
|
|
#16 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
Internet shortcuts are even easier to tweak as they are just ini files.
Do somthing like this..code: PHP Code:
EDIT: Or just read the Wiki article Stu Posted..
|
|
|
|
|
|
#17 | |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
Quote:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
|
#18 | |
|
Junior Member
Join Date: Mar 2002
Posts: 27
|
I found more information out about this issue. From the manual:
Quote:
So.. InstallDir "$PROGRAMFILES32\SCHTHACK PSOBB" has the problem. InstallDir "$PROGRAMFILES32\SCHTHACK PSOBB\" (disables behavior) doesn't have the problem. It seems to be something going wrong in this feature when it enumerates and appends "SCHTHACK PSOBB" to the directory selection. For example, a user will choose "C:\Program Files (x86)" as the directory rather than a sub directory, and NSIS will fill in the sub directory to match the last string of InstallDir after the last \, in this case "SCHTHACK PSOBB," making it auto to C:\Program Files (x86)\SCHTHACK PSOBB\. For some reason this breaks CreateShortcut icon association and perhaps other functions in NSIS. What it looks like is Windows is looking in the 64-bit Program Files directory for the icon when this function is enabled, even though the program is really in the 32-bit Program Files folder, which I think is the result of this features functionality mixing up the 64-bit and 32-bit Program Files folders or how it resolves them. |
|
|
|
|
|
|
#19 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
Are you sure about this? $instdir will normally strip off the \ at the end.
Try: PHP Code:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#20 |
|
Senior Member
Join Date: May 2009
Posts: 152
|
I'm going to have to confirm with Anders.
I modified the test script and the issue remains. Can you provide a script that shows the working vs non? PHP Code:
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|