28 Sep
2010
28 Sep
'10
10:11 a.m.
Mariusz PluciĆski <vshader(a)gmail.com> writes:
+static BOOL GAMEUX_isFileExists(LPCWSTR sFile) +{ + HANDLE hFile; + + hFile = CreateFileW(sFile, GENERIC_READ, 0, + NULL, OPEN_EXISTING, 0, NULL); + + if(hFile == INVALID_HANDLE_VALUE) + return FALSE; + + CloseHandle(hFile); + return TRUE; +}
This sort of thing is not a good idea in general, even if it had a more grammatically correct function name ;-) If you need to load a file you have to open it anyway, so you can check for errors at that point. Checking for existence beforehand is only doing duplicate work. -- Alexandre Julliard julliard(a)winehq.org