[Lazarus] Removing read-only files in FileUtil.DeleteDirectory ?

Bart bartjunk64 at gmail.com
Tue May 1 13:40:11 CEST 2012


On 4/30/12, J├╝rgen Hestermann <juergen.hestermann at gmx.de> wrote:

>  > One might also consider retuning the actual filename/foldername that
>  > could not be removed if things fail, so feedback to the user can be
>  > given.
>
> This would only make sense if a programmer wants to present the file name
> to a user. But if the only reason is to know which file attributes have
> to be
> changed and let the program try to delete them again, then the programmer
> should be saved to do such crude cycles and a flag should tell the
> routine to
> delete in all cases (read-only or not).

The point of my remark was to be able to give feedback to the end
user, if removing failed (e.g. because of file-access rights).

"Unable to remove file:'/path/to/somefile'"

This could be done by an out parameter, or indeed by raising an
exception with the appropriate file/folder-name as suggested above.

Bart




More information about the Lazarus mailing list