altie
2nd February 2010 00:37 UTC
How do I prompt for a disc until the user inserts the right one?
I've spent about a week of poking at this, working on other parts of my installer and coming back to it. The EnumCDs, CABSetup and Cdrom plugins all look relevant but I haven't found an example of how to check for a particular disc.
The context for my request: I'm building an installer that grabs a bunch of patches off a network drive, installs some games from disc (Crysis in particular is one I'm working on) and then it applies the patches.
Thanks for your help.
MSG
2nd February 2010 06:47 UTC
The CD-ROM plugin isn't going to work - it doesn't support DVDs. I created some functions once that will probably do what you need: http://nsis.sourceforge.net/DVD_functions
I still use it to my satisfaction, maybe it'll do you some good.
altie
2nd February 2010 16:32 UTC
I missed your page, looks helpful. I got it working with GetDrives though.
!include FileFunc.nsh
!include LogicLib.nsh
!include nsDialogs.nsh
Function isCrysisDVD
DetailPrint "Checking for Crysis DVD in $9"
${If} ${FileExists} "$9\Crysis.msi"
StrCpy $CrysisInstallerFound True
DetailPrint "Crysis disc found: $9"
ExecWait "msiexec /i $9\Crysis.msi"
StrCpy $0 StopGetDrives
${EndIf}
Push $0
FunctionEnd
Section "Crysis"
CrysisFindDisc:
${GetDrives} "CDROM" "isCrysisDVD"
Pop $0
StrCmp $CrysisInstallerFound True CrysisDone
CrysisRetryCancel:
MessageBox MB_RETRYCANCEL "Please insert a Crysis DVD. If you wish to skip installing Crysis, click cancel." IDRETRY CrysisFindDisc
CrysisDone:
SectionEnd
If you can think of anything I can do to improve this code, let me know. I may refactor it to use your functions later. Either way, a piece of sample code for this task on that page would be very helpful. I'll post it if I end up using your functions.
Afrow UK
2nd February 2010 22:16 UTC
Easiest thing to do is to save $EXEDIR somewhere and use the first character of that as the CD/DVD drive for further disks. That is of course assuming the user won't decide to put the next disk in another CD/DVD drive.
Stu
Joel
3rd February 2010 05:43 UTC
The idea is to use an ini file with some data, which the installer, when asks for the next CD/DVD, will search and read that data from the ini.
MSG
3rd February 2010 07:38 UTC
Joel: Since altie is making a mod/patch/whatever installer for Crysis, modifying the DVD isn't an option.