Archive: Capture Folder Path from Browse Dialog


Capture Folder Path from Browse Dialog
Hi all,

Hope you can help.

I've created an NSIS script that (when compiled and executed) successfully installs and uninstalls application files and registry settings.

The software I am packaging interfaces with a number of supporting files which may be stored in any location (local or network). Supporting files are manually extracted from a ZIP archive and DO NOT need to be installed as part of this package. I do however need to get the user to specify the location of these files (via directory browse) and append the path to the registry.

At present, I am using code below to capture the folder location but this method has an undesireable quirk...When the user clicks next, the application title is appended to the selected location (e.g. user selects 'c:\required_files', which becomes 'c:\required_files\myapp').


$MY_LOCATION
PageEx directory
DirText "Specify location of required files..." "Source" "Please spcefiy location of required files"
DirVar $MY_LOCATION
PageExEnd


I have looked at creating a custom form with folder browser control but have struggled to get it working.

If anyone has any suggestions or examples, I'd be grateful.


Rob.

have a look at the installoptionsreadme:

A "DirRequest" control displays a textbox and a browse button. Clicking the browse button will display a directory requester where the user can browse for a directory.

When the user clicks next, the application title is appended to the selected location (e.g. user selects 'c:\required_files', which becomes 'c:\required_files\myapp').
The manual explains how to stop this from happening:

http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1.21

I resolved this issue as pengyou suggested:

By replacing...


InstallDir "$PROGRAMFILES\My Folder\MyApp"

...with...

InstallDir "$PROGRAMFILES\My Folder\MyApp\"


All that was needed was a trailing backslash.

Many thanks for your help.

Rob.