Fabian Maurer dark.shadow4@web.de writes:
Hello Alexandre,
Again, there's no reason to check the attributes first. Just try to open the file and handle the failure.
Sorry, I misunderstood. I thought it was best practice to check if it exists before trying to open it.
No, that's actually worst practice. Just because it existed at the time you checked doesn't mean it can be opened: it could have been removed in the meantime, or not have enough permissions, or a million other possible errors. You always need to do a proper failure check at open time, so checking beforehand is only a waste of time.