Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
NSIS检查安装位置是否为空_Nsis - Fatal编程技术网

NSIS检查安装位置是否为空

NSIS检查安装位置是否为空,nsis,Nsis,如何添加有关显示安装位置的覆盖对话框的功能 如果用户已经安装了该软件,并且他正试图在同一位置重新安装该软件,那么我想显示您是否需要覆盖的信息 我已经使用了下面的函数,但它是在打开位置页面之前调用的 Function .onVerifyInstDirIfFileExists "$INSTDIR\temp.xls" PathGood PathGood: MessageBox MB_OKCANCEL "Do you want to overwrite the location with new

如何添加有关显示安装位置的覆盖对话框的功能

如果用户已经安装了该软件,并且他正试图在同一位置重新安装该软件,那么我想显示您是否需要覆盖的信息

我已经使用了下面的函数,但它是在打开位置页面之前调用的

Function .onVerifyInstDirIfFileExists "$INSTDIR\temp.xls" PathGood
PathGood:
    MessageBox MB_OKCANCEL "Do you want to overwrite the location with new installer ?" IDOK lbl_ok IDCANCEL lbl_cancel
    lbl_ok:

    lbl_cancel:
    Quit
FunctionEnd 

.onVerifyInstDir
用于禁用“下一步”按钮,它不应显示用户界面:

此代码将在用户每次更改安装目录时调用,因此它不应该对MessageBox之类的东西做任何疯狂的操作。如果此函数调用Abort,则$INSTDIR中的安装路径将被视为无效

如果要显示消息,必须改用“页面离开”回调:

!include LogicLib.nsh

Function MyDirLeave
${If} ${FileExists} "$INSTDIR\temp.xls"
    MessageBox MB_OKCANCEL "Do you want to overwrite the location with new installer?" IDOK +2
    Abort ; Stay on the current page
${EndIf}
FunctionEnd

Page Directory "" "" MyDirLeave
Page InstFiles

谢谢你的帮助。。。!