[英]With NSIS can I share values between MUI_PAGE_DIRECTORY pages?
I have two MUI_PAGE_DIRECTORY pages.我有两个 MUI_PAGE_DIRECTORY 页面。 The first stores the entered data to the default, $INSTDIR.第一个将输入的数据存储到默认值 $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.我想要做的是将 $INSTDIR 中的值复制到定义的 var $DataDir 中,以便在显示第二个目录页面之前,$DataDir 变为 $INSTDIR\\Data。 When the second page is displayed I would like the default value to be $INSTDIR\\Data.当显示第二页时,我希望默认值为 $INSTDIR\\Data。
Is this possible?这可能吗?
What are you trying to achieve?你想达到什么目的?
If you want to install some files into two separate locations use MUI_PAGE_DIRECTORY and custom nsDialogs page (with browse folder button) so user can pick up two directories.如果您想将一些文件安装到两个不同的位置,请使用 MUI_PAGE_DIRECTORY 和自定义 nsDialogs 页面(带有浏览文件夹按钮),以便用户可以选择两个目录。
If your location is always $INSTDIR and second is somewhere inside it ($INSTDIR\\some\\data\\path) then you only need to append your inside path to $INSTDIR - there is no need to show dialog twice and select path twice.如果您的位置始终是 $INSTDIR 而第二个在其中的某个位置 ($INSTDIR\\some\\data\\path),那么您只需要将您的内部路径附加到 $INSTDIR - 无需显示两次对话框并两次选择路径。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.