Archive: newbie 'dirshow' question


newbie 'dirshow' question
Hi,

Backgroup:
I'm writing my first NSIS installer. It's for OpenLDAP, an opensource LDAP server, and I have added some optional packages like an optional password filter dll for syncing user passwords with the operating system.

Problem:
I have a section for the main program and a section for each of the optional packages. But I need for the user to be able to install the option packages in different $INSTDIR directories. For example, I want the server to be installed in $PROGRAMFILES/openldap by default, but the password filter to be installed in $PROGRAMFILES/PasswdHk. Plus the user should be able to change both of these. The documentation says that the 'Dirshow' file selectional keyword can *not* be used inside a 'Section'. So how can I install these optional packages in their own directories?


Here is an Idea. Have the password dll in another installer but just showing the directory selection and the install console. That way, the user can install the password DLL to the directory they want. So, all you have to do in the main installer is:

Section "Password Plug-in"
File inst-pwpl.exe
ExecWait "inst-pwpl.exe"
SectionEnd


There.

-Duane

An other option is to use InstallOptions to display a page of dirselection boxes and text to help the user. This way, you will not need to write new scripts for all packages, you will not have new windows and problems like "BringToFront" and the total package will be much smaller.

Good luck,
-Hendri.


Thanks,

I went the easy route and built a seperate installer.


That's NOT the easy way. As I told before, to overcome problems of the main installer loosing focus you may need to perform some tricks with BringToFront. Besides that, it is difficult to control what the separate installers did (install or cancel). You will need additional regentries or IfFileExists' to control this. Moreover, the user will not like all these separate programs that will be started and also not like to download eg 4 times ~35 Kb where you could do it in only one time ~35 Kb (with a small additonal amount for InstOpts.dll and the ini).

I'll post a simple script later this day.

-Hendri.


Here's some code, based on MultIni4. With some additional work, you can check which sections have been selected and adapt the ini for that so it doesn't ask for a dir for a component that has not been selected.

-Hendri.


Thanks!

I did not know about these problems. I'll use the InstallOptions approach then.

The reason I didn't try the InstallOptions approach originally was because I couldn't find documentation or example code on how to use it. So thanks for the code.

--Kervin


Your welcome.
Good luck with programming the ini. Do not forget to take a look at teh IsSectionSelected macro in MultIni4 (and in my code above). It will help you to find out if a section is selected. All you have to program is that ini settings get deleted when a section is not selected. That way no question will be asked for a component that will not be installed.

Greetz,
-Hendri.