我写了一个设置.在这个设置中没有任何反应,因为我只集中在一个区域:" wpSelectDir ",用户可以在其中选择安装应该安装的目录.
现在我的代码片段应该检查,如果所选目录中存在ANYTHING(任何其他文件夹,文件等).如果是这样,如果用户仍想继续,则会收到警告,因为此目录中的所有内容都将被删除.如果用户只创建了一个新的空文件夹,则不应该收到警告,因为什么都不会丢失.
我已经完成了代码片段,但检查目录是否为空(我将其替换为" if 1 = 1 then ").
请看看:
[Setup]
AppName=Testprogramm
AppVerName=Example
AppPublisher=Exxample
DefaultDirName={pf}\C
DefaultGroupName=C
Compression=lzma
SolidCompression=yes
[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpSelectDir then // if user is clicked the NEXT button ON the select directory window; if1 begins here;
begin
if 1=1 then // if the directory is not empty; thx 4 help stackoverflow
begin // warning with yes and no
if MsgBox('The file contains data. This data will be removed permanently …Run Code Online (Sandbox Code Playgroud) 我的Inno设置文件的[Dirs]部分中有一些声明。我使用“ Inno Setup Compiler”和普通的文本编辑器(Notepad ++)进行开发。在选择安装目录之前取消设置时,{app}变量肯定为空。我收到此错误(完全是逻辑错误):
如何解决在按下“取消”按钮并确认要取消设置后没有错误发生的问题?
内部错误:初始化“ app”常量之前,尝试对其进行扩展。
是否可以全局设置{app}变量或为其提供默认值?
这是一个使用变量{app}的代码片段:
[Dirs]
Name: {app}; Permissions: everyone-readexec
Name: {app}\bin; Permissions: everyone-readexec
[Run]
Filename: "{app}\run.exe; Flags: runhidden
[INI]
Filename: {app}\bin\myIni.ini; Section: Settings;
[InstallDelete]
Name: {app}\*; Type: filesandordirs; Tasks:
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助,问候C。
inno-setup ×2