Inno Setup,一步一步运行代码

时间:2015-08-20 15:35:52

标签: inno-setup

我需要创建一个文件,然后将其与另一个文件合并。这两个步骤都是单独工作,但不是一起工作。

代码:

[Code]
function CreateAcad: Boolean;
var
  Lines: TArrayOfString;
  FileName: string;
begin
  FileName:= ExpandConstant('C:\Program Files\AutoCAD 2009\Support\acad.lsp');
  SetArrayLength(Lines, 3);
  Lines[0] := 'echo hello';
  Lines[1] := 'pause';
  Lines[2] := 'exit';
  Result := SaveStringsToFile(FileName, Lines, True);
end;

procedure AppendFile(const SrcFile, DestFile: string);
var
  SrcStream: TFileStream;
  DestStream: TFileStream;
begin
  SrcStream := TFileStream.Create(SrcFile, fmOpenRead);
  try
    DestStream := TFileStream.Create(DestFile, fmOpenWrite);
    try
      DestStream.Seek(0, soFromEnd);
      DestStream.CopyFrom(SrcStream, SrcStream.Size);
    finally
      DestStream.Free;
    end;
  finally
    SrcStream.Free;
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
    CreateAcad;
  AppendFile('C:\COBIAX\Cordoli\acad.lsp', 'C:\Program Files\AutoCAD 2009\Support\acad.lsp');
end;

0 个答案:

没有答案