Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 23rd March 2011, 17:09   #1
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
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,
NSISNUB is offline   Reply With Quote
Old 24th March 2011, 06:31   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,839
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 is offline   Reply With Quote
Old 24th March 2011, 20:39   #3
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
So I shouldn't be using the MUI_PAGE_DIRECTORY at all then?
NSISNUB is offline   Reply With Quote
Old 25th March 2011, 05:56   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,839
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.
MSG is offline   Reply With Quote
Old 25th March 2011, 07:33   #5
T.Slappy
Senior Member
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 361
Send a message via ICQ to 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.

Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk
Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/
T.Slappy is offline   Reply With Quote
Old 25th March 2011, 12:16   #6
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Any code examples?
NSISNUB is offline   Reply With Quote
Old 25th March 2011, 13:33   #7
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 569
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:
Attached Thumbnails
Click image for larger version

Name:	listviewdemo.png
Views:	41
Size:	32.1 KB
ID:	48649  
pengyou is offline   Reply With Quote
Old 25th March 2011, 13:43   #8
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Yeah I think that one you attached pengyou is what I am looking for minus the browse button.
NSISNUB is offline   Reply With Quote
Old 25th March 2011, 13:46   #9
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 569
You can remove the browse button quite easily - just delete some lines from the example script.
pengyou is offline   Reply With Quote
Old 25th March 2011, 13:50   #10
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Thanks, exactly what I was looking for, great help!
NSISNUB is offline   Reply With Quote
Old 25th March 2011, 16:08   #11
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 192
Examples have been update again just now, please download the latest ones.

An NSIS fan from China, my name is Jia Ke (pinyin).
Email: jiake@vip.qq.com
Messenger: jiake@live.in
QQ (Chinese IM): 550771955
jiake is offline   Reply With Quote
Old 25th March 2011, 17:35   #12
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
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?

Last edited by NSISNUB; 25th March 2011 at 19:18.
NSISNUB is offline   Reply With Quote
Old 26th March 2011, 18:04   #13
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Quote:
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.
NSISNUB is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump