Archive: help plz.. selecting install dir


help plz.. selecting install dir
Hello everyone. Now I'm not a programmer so please no flaming if this is easy to you guys. I have created some ICC profiles that I need to send out to customers. Depending upon their OS the files will be installed in the correct location ie.

for win 98/Me this wouod be sysdir/color

for win2000/xp this would be sysdir/spool/drivers/color

How can I get the installer to automatically detect the OS and then select the correct install path.

I would like to do this in one install file rather than have 2 separate ones for win9x and win2000

Thanks

chooch_t


In the NSIS documentation/help file there is a usefull functions section which contains a function to get the windows version.

Vytautas


Hi, them from one newbie to another. :) I've found a function named 'GetWindowsVersion' in 'NSIS manual > Appendix B'. But i just don't know how to keep on with it, so i'll tell you how i would do it. I would extract the files to both directories, if the user is using 98/ME, it will extract to '${SYSDIR}\color' and won't find the '${SYSDIR}\spool\drivers\color'; if the user is using XP/2K, it will extract sucessfully to ${SYSDIR}\spool\drivers\color and fail when trying to extract to the other directory.

Hihi, hope i helped you!


Not quite, I would work but both locations would have the files created. If you only wish to tell the difference between NT and 9x windows families this code should do the trick.

push $0

ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
IfErrors lbl_win9x lbl_winnt

lbl_win9x:
; extract files for windows 9x here

goto lbl_end

lbl_winnt:
; extract files for windows nt here

goto lbl_end

lbl_end:
pop $0
Just add this code to a section and you are set to go.

Vytautas :D

Hehe, the way Vytautas posted is really better :P But my way would work fine too, it wouldn't extract to both directories because the dirs are exclusive from their OS, there isn't the '${SYSDIR}\spool\drivers\color' in Win98 (at least at mine ;]) and i suppose there isn't the '${SYSDIR}\color' at WinXP/2K. :)


No they don't exist, but NSIS would create the folders if needed.

Vytautas ;)


Hehe, you're right, Vytautas. Have just realized that! :) See you!