[PATCH v2 2/2] find.exe: Implement file searching

Alexandre Julliard julliard at winehq.org
Tue Feb 18 10:37:38 CST 2020


Fabian Maurer <dark.shadow4 at 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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list