[Scummvm-devel] Progress with Archive & SearchManager

Max Horn max at quendi.de
Fri Oct 3 15:20:42 CEST 2008


Hi folks,

my stance on the whole issue is this: I don't have a fundamental  
objection against searching the current dir, too. But the way we used  
to do it was bad, because we added one extra lookup for every file  
just for that. In addition, the code as it was allowed client code to  
open files using file paths, both absolute and relative ones, which  
was not the idea.

Hence, I dropped the code from File::open which acted as a fallback to  
handle these; that code would create an FSNode for every file "name"  
it failed to open via the normal means.

Removing this uncovered various places (most prominently, the Advanced  
Detector!) which created FSNodes, used getPath() on the node, and then  
used that path to refer to the file (e.g. for opening it). Not good. I  
think I fixed all incorrect uses of getPath() now; and the changes to  
File::open should ensure that no new cases should be introduced in the  
future.

At the same time, I now modified the SearchManager to add the current  
dir to the end of the list of directories to search for files. This  
fixes the "issue" with the Windows port keeping all its files there by  
default. Now, I am not quite happy with the Windows port doing that in  
first place, but I realize there might be no better option on Windows  
by default; and also, even if there was one, I don't want to break  
(tens of) thousands of existing installations just out of a  
misunderstood sense of cleanliness ;).


All in all, I think the "cleanup class File" project has been a major  
success. Just compare the File::open method in 0.12.0 with our current  
one. Oh, and also File::exists and File::open now really return  
matching results (previously, it was possible that exists() found a  
file but open() didn't, and vice versa).

The only bit I still don't really like is that File::open searches not  
just for "FILENAME" but also for "FILENAME.", i.e. with a trailing dot  
added. But I understand that this is to cover issues with Simon/ 
Simon2, maybe more games. Maybe we can at least refine this hack, to  
only try the trailing dot if the given filename does not contain a dot  
already. But all in all, this hack isn't so bad, and it *might* be  
useful for other games, too... If you know of any examples, I'd be  
delighted to hear about them!

Cheers,
Max




More information about the Scummvm-devel mailing list