blackcoder
7th November 2010 13:20 UTC
Uninstaller - delete Winamp-Plugin
Hello,
i have written a program consisting of one application, which gets installed in a program-folder and a winamp-plugin which gets installed in the plugin-folder from winamp.
Now i have got the problem, that my uninstaller deletes everything (application, uninstaller, shortcuts, application-folder, ...), but not the winamp-plugin. If i have two seperate installers it works. First i had two installers and started the next installer on the .onInstSuccess. I tried a similar way with the uninstalling part, but didn't got it working. Now i tried it the way it is in the attached nsi-file, but doesn't work also. :cry:
I attached the nsi-file.
Animaether
7th November 2010 13:56 UTC
Maybe it's because it's Sunday, but I'm not seeing anything fundamentally wrong with what the code should be doing.
Have you verified that the path you're feeding to the delete command (the one you're putting up in a messagebox) is the correct path? ( I see the script using a define for the dll file on the installer side and hardcoded names in the uninstaller. )
Have you verified that as far as NSIS is concerned, that file also exists in that location?
${If} ${FileExists} "<path>"
MessageBox MB_OK "Yup - `<path>` exists."
If all that seems to check out...
Have you verified that the delay you're using is actually long enough? I.e. the file might still be locked by a process (winamp or otherwise) after all. You could use a MessageBox to arbitrarily set the delay by hand. If it turns out this might be the issue, see this thread on handling that sort of thing a bit better:
http://forums.winamp.com/showpost.ph...38&postcount=4
If it seems the file always remains locked, go download Unlocker or Process Explorer or so to find out what process might have your DLL file locked. This seems a bit unlikely as your separate uninstallers did work OK.. just not ruling it out :)
Basically, just start picking apart the entire process line by line where things -might- go wrong.
Unrelated: In your uninstall code you determine the WinAmp folder by checking the registry.. why not use that in your .onInit to set the default $ANOTHER_DIR as well? :)
blackcoder
7th November 2010 20:36 UTC
Thank you for your help. I got it working now. The problem was that ReadRegStr returned the path with quotes at the beginning and the end ("C:\Program Files (x86)\Winamp\UninstallWA.exe"). Further i noticed then that when using GetParent on that string it removes the filename as it should, but did not add the quote at the end ("C:\Program Files (x86)\Winamp). I added some function to remove the quotes to get this working.
Found another problem then with ReadRegStr and $InstDir. If i use $InstDir then the colon is missing in the string ("C\Program Files (x86)\Winamp\UninstallWA.exe"). I had to use an own variable to get that string with colon.
Now one problem lasts. Using my Installer on Vista works fine, but using it on Windows XP ends up in a missing entry in the Start menu. Is this related to "SetShellVarContext all"?
I attached my nsi-file with the changes in it.
Animaether
7th November 2010 21:51 UTC
Try creating the start menu folder before creating the shortcut.. at least on XP, the folder doesn't get automatically created.
SetOutPath"$SMPROGRAMS\${APP_ALT}" /* create folder */
SetOutPath "$INSTDIR" /* set active folder for shortcut */
CreateShortCut "$SMPROGRAMS\${APP_ALT}\${APP_ALT} - Uninstall.lnk" "$INSTDIR\uninstall.exe"
blackcoder
7th November 2010 22:54 UTC
Thank you. That was the problem. :)
I was wondering why setoutpath. Didn't know that it would create a folder, too.
SetOutPath
Sets the output path ($OUTDIR) and creates it (recursively if necessary), if it does not exist.
I tried CreateDirectory instead of SetOutPath and this works fine.
CreateDirectory "$SMPROGRAMS\${APP_ALT}"
>CreateShortCut "$SMPROGRAMS\${APP_ALT}\${APP_ALT} - Uninstall.lnk" "$INSTDIR\uninstall.exe"
>CreateShortCut "$SMPROGRAMS\${APP_ALT}\${APP_ALT}.lnk" "$INSTDIR\${APP_FILE}.exe"
Animaether
8th November 2010 01:42 UTC
CreateDirectory ought to work just as well, really - but it won't change the active folder for any shortcuts subsequently created.. so I usually end up using SetOutpath for just about everything.