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