[Scummvm-devel] ScummVM PS2 backend - to be or not to be... a directory

Max Horn max at quendi.de
Fri Feb 22 21:48:07 CET 2008


Am 22.02.2008 um 15:05 schrieb LavosSpawn:

>>
>>>> That's definetely the bug. I made it out in an empirical way:
>>>>
>>>> I counted the delta between two successful 'open' fd, and counted
>>>> the number of failed 'dopen' in-between. Tada! If you try to dopen
>>>> a non-directory item, you lose one fd. So that ruled out my first
>>>> solution to check whether a file was a dir ot not with 'dopen'.
>>>>
>>>>
> What I don't understand is..
> why does the backend need to provide a function for that in the  
> first place?
> I mean, we are already able to list the corresponding parent directory
> and provide flags for each element to tell if an entry is a file or
> directory.
> So if the engine knows that there is an entry with the name xyz, why
> does it need to check if it's a dir or file? shouldn't it always  
> already
> know?

Well, imagine when you just want to know whether "somefile.txt"  
exists, without first getting a full list of all files in all search  
dirs, and then scanning through that... ;)

And if a backend can provide a listing of all files in a directory,  
it should also easily be able to tell whether a given file exists or  
not, no?

Cheers,
Max




More information about the Scummvm-devel mailing list