首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何登录Inno安装程序?

如何登录Inno安装程序?
EN

Stack Overflow用户
提问于 2011-02-25 18:41:30
回答 3查看 17.4K关注 0票数 21

Inno安装程序有命令行参数/LOG="filename"。是否可以从Inno设置脚本中指定日志文件名,以便以后可以将其包含在错误报告中?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-02-25 22:19:47

您可以设置SetupLogging选项(SetupLogging=yes),然后将以下代码集成到脚本中,以便将日志复制到某个地方。

代码语言:javascript
复制
procedure CurStepChanged(CurStep: TSetupStep);
var
  logfilepathname, logfilename, newfilepathname: string;
begin
  logfilepathname := ExpandConstant('{log}');
  logfilename := ExtractFileName(logfilepathname);
  newfilepathname := ExpandConstant('{app}\') + logfilename;

  if CurStep = ssDone then
  begin
    FileCopy(logfilepathname, newfilepathname, false);
  end;
end; 
票数 24
EN

Stack Overflow用户

发布于 2014-01-29 21:52:44

在Lars的评论之后,我使用了DeinitializeSetup()过程,但我还更改了新的文件路径,使用{src}常量将日志文件复制到运行安装程序的目录,而不是{app}常量,如果用户取消安装,可能会/可能不会创建该常量:

代码语言:javascript
复制
// Called just before Setup terminates. Note that this function is called even if the user exits Setup before anything is installed.
procedure DeinitializeSetup();
var
  logfilepathname, logfilename, newfilepathname: string;
begin
  logfilepathname := ExpandConstant('{log}');
  logfilename := ExtractFileName(logfilepathname);
  // Set the new target path as the directory where the installer is being run from
  newfilepathname := ExpandConstant('{src}\') + logfilename;

  FileCopy(logfilepathname, newfilepathname, false);
end; 
票数 16
EN

Stack Overflow用户

发布于 2021-04-22 18:43:50

从JasonMcF扩展示例...检查是否创建了卸载程序,以查看安装程序是否已成功完成。

代码语言:javascript
复制
// Called just before Setup terminates.
// Note that this function is called even if the user exits Setup before anything is installed.
procedure DeinitializeSetup();
var
    unInstaller, logFilePath, logFileName, newFilePath: string;
begin
    unInstaller := ExpandConstant('{uninstallexe}');

    logFilePath := ExpandConstant('{log}');
    logFileName := ExtractFileName(logFilePath);
  
    if FileExists(unInstaller) then
    begin
        // uninstaller exists, setup was finished successfully, copy log to app directory
        newFilePath := ExpandConstant('{app}\') + logFileName;
    end
        else
    begin
        // setup didn't finish successfully, copy log to src directory
        newFilePath := ExpandConstant('{src}\') + logFileName;
    end;

    Log('DeinitializeSetup');
    Log('- unInstaller:' + unInstaller);
    Log('- logFilePath:' + logFilePath);
    Log('- newFilePath:' + newFilePath);

    FileCopy(logFilePath, newFilePath, false);
end;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5116217

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档