tags:

views:

538

answers:

3

Hi,

I'm very new to NSIS and to stackoverflow.. so let me start with a "basic" question.

I wanted to write an *.nsi script, let's call it for now setup.nsi, and check if several *.dll (from where I am copying the files) exists in $SYSDIR

Let me emphasize on the word "several"

What I understand from nsis IfFileExists documentation is that if I type in:

IfFileExists $SYSDIR\blabla.dll +2 +1

then it checks if blabla.dll is in $SYSDIR .. but what if I want to know if *.dll from where setup.nsi copies the file (i.e. the *.dll's that I am interested in installing in.. and they are a lot of them.. so I can't just go around checking for all the names) exists in $SYSDIR

During uninstallation I want to then be able to delete them from $SYSDIR (using some uninstall.log to see if I really copied them in $SYSDIR.. and again the wildcard question).

Please be patient with me as I am really new to NSIS scripts.

+2  A: 

Is it REALLY necessary to write and delete in $SYSDIR ? Unless yours is a system file, there's no reason for it to be in $__SYS__DIR. If you need to use a specific version of a library, consider DLL redirection (put your DLL in your app dir and use the .local feature) - see the MSDN article on DLL redirection and Side-by-side assemblies.

Plus, you are one typo away from wrecking the user's computer ("Deleted: C:\Windows\System32\user32.dll").

Piskvor
+1 - I would NOT attempt to wildcard delete DLLs in SYSDIR. I'd also keep them in your application directory unless it is necessary to do otherwise.
Joshua McKinnon
A: 

As Piskvor mentions, I don't think you should be worrying about deleting system DLLs in the uninstaller. In case you want to overwrite system DLLs with an updated version, you may want to look at the SetOverwrite command. It lets you overwrite files if what you've got is newer.

fakeleft
A: 

Windows XP (SP2?) and up has file protection for system32, so you can't overwrite system critical files in there.

Do try to stay away from that.

Also, to check for your file specifically, see if there's a plugin for NSIS that can calculate checksums and compare that on uninstall. That's probably the safest, IF you really need to do it.

I'd suggest install files somewhere else and add that to PATH.

Marcus Lindblom