0

I have two MUI_PAGE_DIRECTORY pages. The first stores the entered data to the default, $INSTDIR. What I would like to do is copy the value in $INSTDIR to the defined var $DataDir so that before the second directory page is displayed, $DataDir becomes $INSTDIR\Data. When the second page is displayed I would like the default value to be $INSTDIR\Data.

Is this possible?

4

2 回答 2

1

你想达到什么目的?

如果要将某些文件安装到两个单独的位置,请使用 MUI_PAGE_DIRECTORY 和自定义 nsDialogs 页面(带有浏览文件夹按钮),以便用户可以选择两个目录。

如果您的位置始终是 $INSTDIR 并且第二个位于其中的某个位置 ($INSTDIR\some\data\path),那么您只需将内部路径附加到 $INSTDIR - 无需显示两次对话框并选择两次路径。

于 2014-04-10T05:56:08.610 回答
1
InstallDir $ProgramFiles\MyApp

Var DataDir
!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstDirPageLeave
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_DIRECTORYPAGE_VARIABLE $DataDir
!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose Data directory for bla bla bla..."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data Directory:"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DataDirShowPage
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

Function InstDirPageLeave
StrCpy $DataDir "$InstDir\Data"
FunctionEnd

Function DataDirShowPage
!insertmacro MUI_HEADER_TEXT "Foo" "Bar"
FunctionEnd

Section
DetailPrint $InstDir
DetailPrint $DataDir
SectionEnd
于 2014-04-10T16:33:15.743 回答