Archive: Destination Folder


Destination Folder
I have enabled MUI_PAGE_DIRECTORY to allow the Destination folder to be set, however my problem is I want to only allow the Drive letter of the directory to change not the folder name.

How can this be done?

thanks,


A very dirty solution would be to StrCpy $INSTDIR $INSTDIR 2 , but that's guaranteed to go wrong at some point: If the user enters a network path, for example. You could create a custom page with for example a dropdown select box, and populate that by enumerating all results from kernel32::GetLogicalDrives. See here for an example implementation.


So I shouldn't be using the MUI_PAGE_DIRECTORY at all then?


If you're going to create a custom page then yes, you wouldn't use the directory page. If you want to use the directory page anyhow, you're probably interested in the GetRoot macro in filefunc.nsh.


Create custom page using nsDialogs like this:
http://www.unsigned-softworks.sk/en/...echnical_2.jpg

But do not create a Browse button as me and set EditBox for ReadOnly
User can select drive in box below path which changes the first letter only, not the whole path.


Any code examples?


There are eight example scripts in the ListView Header zip file which can be found here:
http://nsis.sourceforge.net/Header_file_for_Listview

Here is a screenshot from a very slightly modified version of the example.nsi script in that zip file:


Yeah I think that one you attached pengyou is what I am looking for minus the browse button.


You can remove the browse button quite easily - just delete some lines from the example script.


Thanks, exactly what I was looking for, great help!


Examples have been update again just now, please download the latest ones.


Hey I got rid of the Browse Button, but how do you make the directory read only?
How can you restrict the drive types? ie. no usb etc.
Is there a easy way to grab the amount of free space value for the selected drive?


Originally posted by NSISNUB
Hey I got rid of the Browse Button, but how do you make the directory read only?
How can you restrict the drive types? ie. no usb etc.
Is there a easy way to grab the amount of free space value for the selected drive?
Got it all working.