Old 16th April 2006, 19:17   #1
wobo99
Junior Member
 
Join Date: Apr 2006
Location: Germany
Posts: 3
Question program and data dir

Hello,
I'm new in NSIS programing and my problem is that I need an installer for some XLS-files. I need an installer to install some files in a so called "program directory" and some other files in an "data directory". The user shold be able to chose this directories. There are some examples of installations with a second target directory, but I found no way to use it for me. I think the main problem for me is the connection between the page and the file lists.

Sorry for my english,
wobo99 is offline   Reply With Quote
Old 16th April 2006, 21:13   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You can try this:

http://nsis.sourceforge.net/Two_inst..._one_installer

-Stu
Afrow UK is offline   Reply With Quote
Old 17th April 2006, 09:20   #3
wobo99
Junior Member
 
Join Date: Apr 2006
Location: Germany
Posts: 3
Thank you for your help Afrow UK,

I found this tread for my self, but it's very complex for me at this time (components, more than 1 section ...). The other thread i found was
Problem to have two directories in one installer ?
but there is no realy usable example, now I tried it with the following solution, I look forward to your comment.
;-----------------------------------------------
;Test.nsi

OutFile "Setup.exe"

XPStyle on

InstallDir "$PROGRAMFILES\Test"

Var DATA_DIR

Page Directory

PageEx directory
DirText "Data"
DirVar $DATA_DIR
PageCallbacks DirectoryPre
PageExEnd

Page Instfiles

Section
SetOutPath $INSTDIR
File "C:\Test\Prog\*"
SetOutPath $DATA_DIR
File "C:\Test\Dat\*"
SectionEnd

Function DirectoryPre
StrCpy $DATA_DIR "$PROGRAMFILES\Test\Data"
FunctionEnd
;-----------------------------------------------
wobo99 is offline   Reply With Quote
Old 17th April 2006, 10:22   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That's how it's done normally. It'd be easier with Modern UI though.
code:
Var INSTDIR2

# First directory page.
!insertmacro MUI_PAGE_DIRECTORY

# Second directory page.
!define MUI_DIRECTORYPAGE_VARIABLE $INSTDIR2
!define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre
!insertmacro MUI_PAGE_DIRECTORY

Function DirectoryPre
StrCpy $INSTDIR2 "$PROGRAMFILES\Test\Data"
FunctionEnd



-Stu
Afrow UK is offline   Reply With Quote
Old 18th April 2006, 19:29   #5
wobo99
Junior Member
 
Join Date: Apr 2006
Location: Germany
Posts: 3
Thumbs up

It works very fine - thank you!
wobo99 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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