Substituir um texto em um arquivo com o Inno Setup
Oi Eu tenho um problema com a substituição de um texto em um arquivo de texto com o Inno Setup (baseado em Delphi).
Meu Código:
procedure FileReplaceString(const FileName, searchstring, replacestring: string);
var
fs: TFileStream;
S: string;
begin
fs := TFileStream.Create(FileName, fmOpenread or fmShareDenyNone);
try
SetLength(S, fs.Size);
fs.ReadBuffer(S[1], fs.Size);
finally
fs.Free;
end;
{ the compiler stops here with: unknown identifier 'StringReplace' }
S := StringReplace(S, SearchString, replaceString, [rfReplaceAll, rfIgnoreCase]);
fs := TFileStream.Create(FileName, fmCreate);
try
fs.WriteBuffer(S[1], Length(S));
finally
fs.Free;
end;
end;
Eu descobri que tenho que usarStringChange()
, mas não sei como usá-lo com meu código. Eu não sei muito sobre Delphi ou Inno Setup. Espero que você possa me ajudar.