wobo99
16th April 2006 20:17 UTC
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,
Afrow UK
16th April 2006 22:13 UTC
You can try this:
http://nsis.sourceforge.net/Two_inst..._one_installer
-Stu
wobo99
17th April 2006 10:20 UTC
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
;-----------------------------------------------
Afrow UK
17th April 2006 11:22 UTC
That's how it's done normally. It'd be easier with Modern UI though.
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
wobo99
18th April 2006 20:29 UTC
It works very fine - thank you!