为每个文件调用Inno Setup AfterInstall函数 [英] Inno Setup AfterInstall function called for each file

查看:214
本文介绍了为每个文件调用Inno Setup AfterInstall函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在安装文件夹后调用一个函数,但是InstallEnv函数似乎已被调用多次,也许每个文件都是该文件夹(待确认).安装所有这些文件后,是否有办法仅调用一次?我不能使用Run部分,因为我想用返回码捕获错误.

I want to call a function after installing a folder, but the InstallEnv function is seems to be called several times, maybe for each file is the folder (to be confirmed). Is there a way to call it only once after it installed all of those files? I can't use the Run section because I want to do error catching with the return code.

Source: "InputFiles\virtualenv-1.8.2\*"; DestDir: "{tmp}/virtualenv"; \
    Flags: recursesubdirs; AfterInstall: InstallEnv; 

推荐答案

是的,每个文件执行一次. reference 这样说(我强调):

Yes, it executes once per each file. The reference says about it (emphasized by me):

[文件]部分条目的安装前或安装后功能 匹配每个通配符的文件将被使用一次通配符.使用 CurrentFileName,以检查调用该函数的文件.

A BeforeInstall or AfterInstall function for a [Files] section entry using a wildcard is called once per file matching the wildcard. Use CurrentFileName to check for which file the function is called.

不,安装完所有文件后无法调用一次.如果只运行一次,那将不是问题,因为您可以声明一个标志变量,表明该函数已被调用,但是您想检测它是否是最后一个调用,为此没有解决方法.

And no, there is no way to call it once after all the files are installed. If you were going to run it only once, it wouldn't be a problem, since you might declare a flag variable, indicating that the function was already called, but you want to detect if it's the last call, and for this there is no workaround.

好吧,也许您知道哪个文件是该文件夹中最新安装的文件,您可以根据

Well, maybe if you would know, which file will be the latest installed from that folder, you might check that against the result of the CurrentFileName function call, but I doubt that you can determine which one will be installed as last at compilation time (since at runtime, there is currently no way to get list of files to be installed).

这篇关于为每个文件调用Inno Setup AfterInstall函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆