本文介绍了Inno Setup,仅安装在不存在的目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不允许在现有目录或至少一个非空目录上进行安装.
I would like to not permit the installation on an existent directory or at least a non-empty one.
现在,我正在使用此替代方法来检查程序是否已安装在用户选择的目录中,但是如果它是未安装程序的目录或非空目录,则无法使用.
Right now I am using this workaround just to check if the program was installed in the directory chosen by the user but this doesn't work if it is a directory where the program was not installed or a non empty one.
function NextButtonClick(PageId: Integer): Boolean;
begin
Result := True;
if (PageId = wpSelectDir) and FileExists(ExpandConstant('{app}\some_app_file')) then
begin
MsgBox('Warning message, cannot continue.', mbError, MB_OK);
Result := False;
exit;
end;
end;
我有DirExistsWarning=yes
指令,但这还不够.
I have the DirExistsWarning=yes
directive but it's not enough.
感谢您的帮助.
推荐答案
使用DirExists(ExpandConstant('{app}'))
检查所选目录是否存在.
Use DirExists(ExpandConstant('{app}'))
to check for an existence of the selected directory.
这篇关于Inno Setup,仅安装在不存在的目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!