Ver Fonte

--- Merging r23371 into '.':
U packages/fcl-base/src/base64.pp
--- Merging r23593 into '.':
U packages/fcl-base/src/inifiles.pp

# revisions: 23371,23593
r23371 | marco | 2013-01-13 13:46:56 +0100 (Sun, 13 Jan 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-base/src/base64.pp

* fixed minor mistake in comment. Mantis #23631
r23593 | michael | 2013-02-11 09:15:13 +0100 (Mon, 11 Feb 2013) | 1 line
Changed paths:
M /trunk/packages/fcl-base/src/inifiles.pp

* Attempt to create directory, fail if not possible

git-svn-id: branches/fixes_2_6@23902 -

marco há 12 anos atrás
pai
commit
1fd14015eb
2 ficheiros alterados com 12 adições e 2 exclusões
  1. 1 1
      packages/fcl-base/src/base64.pp
  2. 11 1
      packages/fcl-base/src/inifiles.pp

+ 1 - 1
packages/fcl-base/src/base64.pp

@@ -47,7 +47,7 @@ type
    *    - follows RFC3548
    *    - rejects any characters outside of base64 alphabet,
    *    - only accepts up to two '=' characters at the end and
-   *    - requires the input to have a Size being a multiple of 4; otherwise raises an EBase64DecodeException
+   *    - requires the input to have a Size being a multiple of 4; otherwise raises an EBase64DecodingException
    * - 'MIME mode':
    *    - follows RFC2045
    *    - ignores any characters outside of base64 alphabet

+ 11 - 1
packages/fcl-base/src/inifiles.pp

@@ -198,6 +198,9 @@ type
 
 implementation
 
+Resourcestring
+  SErrCouldNotCreatePath = 'Could not create directory "%s"';
+
 const
    Brackets  : array[0..1] of Char = ('[', ']');
    Separator : Char = '=';
@@ -922,6 +925,8 @@ procedure TIniFile.UpdateFile;
 var
   slLines: TStringList;
   i, j: integer;
+  D : String;
+  
 begin
   slLines := TStringList.Create;
   try
@@ -944,7 +949,12 @@ begin
           slLines.Add('');
       end;
     if FFileName > '' then
-      slLines.SaveToFile(FFileName)
+      begin
+      D:=ExtractFilePath(FFileName);
+      if not ForceDirectories(D) then
+        Raise EInoutError.CreateFmt(SErrCouldNotCreatePath,[D]);
+      slLines.SaveToFile(FFileName);
+      end
     else if FStream <> nil then
       slLines.SaveToStream(FStream);
     FillSectionList(slLines);