|
@@ -154,22 +154,22 @@ end;
|
|
procedure TJSONConfig.Flush;
|
|
procedure TJSONConfig.Flush;
|
|
|
|
|
|
Var
|
|
Var
|
|
- F : Text;
|
|
|
|
|
|
+ F : TFileStream;
|
|
S : TJSONStringType;
|
|
S : TJSONStringType;
|
|
|
|
|
|
begin
|
|
begin
|
|
if Modified then
|
|
if Modified then
|
|
begin
|
|
begin
|
|
- AssignFile(F,FileName);
|
|
|
|
- Rewrite(F);
|
|
|
|
|
|
+ F:=TFileStream.Create(FileName,fmCreate);
|
|
Try
|
|
Try
|
|
if Formatted then
|
|
if Formatted then
|
|
S:=FJSON.FormatJSON(Formatoptions,FormatIndentSize)
|
|
S:=FJSON.FormatJSON(Formatoptions,FormatIndentSize)
|
|
else
|
|
else
|
|
S:=FJSON.AsJSON;
|
|
S:=FJSON.AsJSON;
|
|
- Writeln(F,S);
|
|
|
|
|
|
+ if S>'' then
|
|
|
|
+ F.WriteBuffer(S[1],Length(S));
|
|
Finally
|
|
Finally
|
|
- CloseFile(F);
|
|
|
|
|
|
+ F.Free;
|
|
end;
|
|
end;
|
|
FModified := False;
|
|
FModified := False;
|
|
end;
|
|
end;
|