Browse Source

* Fix bug #29935

git-svn-id: trunk@33397 -
michael 9 years ago
parent
commit
1a032303ff
1 changed files with 5 additions and 5 deletions
  1. 5 5
      packages/fcl-json/src/jsonconf.pp

+ 5 - 5
packages/fcl-json/src/jsonconf.pp

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