Skip to content
⌘ NSIS Forum Archive

Destination Folder

13 posts

NSISNUB#

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,
MSG#
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.
MSG#
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.
T.Slappy#
Create custom page using nsDialogs like this:


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.
pengyou#
There are eight example scripts in the ListView Header zip file which can be found here:


Here is a screenshot from a very slightly modified version of the example.nsi script in that zip file:
NSISNUB#
Yeah I think that one you attached pengyou is what I am looking for minus the browse button.
pengyou#
You can remove the browse button quite easily - just delete some lines from the example script.
NSISNUB#edited
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?
NSISNUB#
Originally Posted by NSISNUB View Post
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.