Archive: Using the $Desktop Directive with Delete


Using the $Desktop Directive with Delete
Hello,

I am using NSIS 1.98. I have been trying to delete Desktop shortcuts in my Uninstall section. The following is my code:

Section Uninstall
SetShellVarContext "Current"
Delete "$DESKTOP\L1.lnk"
Delete "$DESKTOP\L2.lnk"
Delete "$DESKTOP\L1Uninstall.lnk"
DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\L1"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\L1"
Delete "$INSTDIR\*.*"
RMDir "$INSTDIR"
SectionEnd

I am using Windows XP and I have the permission to delete these files. It doesnt matter where the Delete directive is, or if I use the SetShellVarContext, it still fails.


Any Ideas?
Kevin Costain


Do you get the right directory when you use:

MessageBox MB_OK $DESKTOP?


Thanks..
That was it.. I had the wrong directory, once I fixed that - it worked..

Kevin


I don't understand... Did NSIS get the desktop folder wrong or did you just needed some other folder?


If I was to look at it, I was trying to change the Context of the folders assuming that the default context was "All" (I had set this using a SetShellVarContext "All" command in an earlier section), this wasn't working with or without the command:

SetShellVarContext "Current"

The key here is, once I used MessageBox to debug the actual directory, I was able to see that the default was "current" and I needed to set "All" again.

Thanks for the help...

Kevin


Please note that there is a bug with SetShellVarContext All and Windows 9x in NSIS 1.98. Instead of falling back to current it will give you the temp folder. This bug has been fixed in NSIS 2.


Thanks for the info, how can I get a copy of NSIS 2? I looked at the http://www.nullsoft.com/free/nsis/ page and 1.98 is still there.... ?


Originally posted by kcostain
Thanks for the info, how can I get a copy of NSIS 2? I looked at the http://www.nullsoft.com/free/nsis/ page and 1.98 is still there.... ?
pls visit nsis.sf.net

I've been there... only a pre-release is available.. I guess I could use that but I'm not sure if that will create more problems then its worth...


Originally posted by kcostain
Thanks for the info, how can I get a copy of NSIS 2? I looked at the http://www.nullsoft.com/free/nsis/ page and 1.98 is still there.... ?
Originally posted by hotice
pls visit nsis.sf.net
Originally posted by kcostain
I've been there... only a pre-release is available.. I guess I could use that but I'm not sure if that will create more problems then its worth...
The pre-release version of NSIS 2 works fine. I haven't encountered any bugs yet (except in the documentation). And, any bugs that are found will be fixed immideatly. Download
http://nsis.sourceforge.net/nightly/nsis.zip
for the latest version (NSIS 2.0b). It is updated twice a day!