我正在使用NSIS创建安装程序.此安装程序实际上在同一安装程序中的两个不同目录中安装了两个程序.我这样做是使用现代用户界面(MUI)页面,只需调用MUI_PAGE_DIRECTORY两次指定不同的起始参数,并捕获LEAVE宏中的目录.我想知道的是,我可以以某种方式在函数中调用InstallDir,还是在函数中设置自动目录填充值?或者甚至可能在返回浏览按钮后调用函数?
我想这样做的原因是,当用户单击两个目录页面中的任何一个中的浏览按钮时,在选择目录后,将附加在InstallDir中指定的finnal目录的名称.
例如:程序1的InstallDir值:c:\ client程序2的InstallDir值:c:\ program files\server
用户单击浏览程序1并选择c:\ temp,结果路径为c:\ temp\client
用户单击浏览程序2并选择c:\,无论生成的路径是c:\ whatever\server
这里参考的是我所拥有的代码片段,但不处理自动追加浏览按钮的行为:
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ClientDirectoryLeave
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ServerDirectoryLeave
!insertmacro MUI_PAGE_DIRECTORY
; Setup the page display for the client install page
Function ShowPageClient
!insertmacro MUI_HEADER_TEXT "Client" "Client"
!insertmacro MUI_INNERDIALOG_TEXT 1006 "Client"
; setup intal directory
Push $0
StrCpy $0 $PROGRAMFILES 2 #
; CLIENT_FOLDER_NAME is defined as a folder, but this would basicaly
; result in C:\Client as the first 2 characters of $PROGRAMFILES
; is the hard drive …Run Code Online (Sandbox Code Playgroud) nsis ×1