[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [PATCH 1/4] gameux: initial implementation of loading game
From:       Mariusz Pluciński <vshader () gmail ! com>
Date:       2010-09-30 15:13:03
Message-ID: 4CA4A8FF.4000205 () gmail ! com
[Download RAW message or body]

W dniu 28.09.2010 17:11, Alexandre Julliard pisze:
> Mariusz Pluciński<vshader@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.
OK, I'll redesign process of loading these data. Thanks for advice.

-- 
Best regards
Mariusz Pluciński



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic