[Lazarus] RE : Removing read-only files in FileUtil.DeleteDirectory ?
Ludo Brands
ludo.brands at free.fr
Mon Apr 30 14:16:22 CEST 2012
> Regarding issue #21855
> http://bugs.freepascal.org/view.php?id=21855
>
> I am planning to reject the patch but I would like to have other
> opinions, too.
I'm in favor of patch with current definition (no default parameters as
suggested by Bart) and with following ammendment:
if RemoveReadOnlyFiles and ((FileInfo.Attr and faReadOnly)>0) then
if FileSetAttrUTF8(CurFilename, FileInfo.Attr-faReadOnly) <> 0 then
exit;
Instead of
if RemoveReadOnlyFiles and ((FileInfo.Attr and faReadOnly)>0) then
FileSetAttrUTF8(CurFilename, FileInfo.Attr-faReadOnly);
This way the function exits as soon as something goes wrong. No need
iterating in directories when the attribute of the directory itself can't be
changed.
Ludo
More information about the Lazarus
mailing list