mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:49:22 +02:00
* Attempt to create directory, fail if not possible
git-svn-id: trunk@23593 -
This commit is contained in:
parent
1b9842c33a
commit
aca21b0b60
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user