当前位置: 动力学知识库 > 问答 > 编程问答 >

Inno Setup, run code step by step

问题描述:

I need to create a file and then merge it with another one. Both steps work individually, but not together.

Code:

[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;

分享给朋友:
您可能感兴趣的文章:
随机阅读: