Archive: file browse on cd-rom only


file browse on cd-rom only
Is there a way to only allow end user to browse for files on the cd-rom? So if I want them to choose a template for the install, I want to make sure it's from the cd-rom.

Thanks


Once you have a path, you decide if it refers to a CD-Drive or to some other device (e.g. HDD) by calling the "GetDriveType" function. The return value will be DRIVE_CDROM for CD/DVD drives. For other device types you'll get a different return value, e.g. DRIVE_FIXED.

http://msdn.microsoft.com/en-us/library/aa364939.aspx


Thanks, I have the drive type and path, but then the user clicks the button to browse for the template and they can browse anywhere they have rights. I want to restrict this to the folder and all sub folders on the cd-rom.


maybe this was missed :D


Use the .onVerifyInstDir callback-function. This function will be called everytime the user selects a new folder. Even when the user makrs a folder in the "browse" dialog, that function will be called first (before the user get's the chance to click "OK"). So simply check the value of $INSTDIR within that function. If $INSTDIR doesn't point to a DRIVE_CDROM device, then you can call the Abort command. This will gray out the "OK" button in the "browse" dialog and it will gray out the "Next" button of the Diretcory page. Let the callback-function run to the end, if the selected folder is valid...