Ben Hutchings wrote:
Or, less elegantly, you could always catch the exception in the procedure.
Since the filesystem is normally shared with other processes which may change it at any time, you should be prepared for file operations to fail even if you check in advance that they should work. So checking in advance cannot substitute for exception-handling; it's extra programming effort and may actually be slower than handling the occasional exception.
Ben.
I do both. However, for the problem I was describing, it's already too late when the exception is caught, because application flow terminates for a (IMO) minor reason at a point where I can't go back. But of course, I still catch filesystem_errors on several occasions. -- Matthias Kaeppler