[Scummvm-devel] How to open files in a deep tree structure?

Max Horn max at quendi.de
Mon Dec 1 18:58:24 CET 2008


Am 01.12.2008 um 18:26 schrieb Ori Avtalion:
[...]
> Unfortunately, ScummVM only agrees to open files that are 3  
> directories
> deep. This seems to be set in base/main.cpp:347:
>
>    // Add the game path to the directory search list
>    SearchMan.addDirectory(dir.getPath(), dir, 0, 4);
>
> Changing the "4" to "5" causes the files to open with no error.
>
> My questions:
> Is there a way to change it programatically? Am I even using the  
> correct
> method to open files?

Yes.

The way to change it for now will be to add this line to your init()  
method:

   SearchMan.addDirectory(dir.getPath(), dir, 0, 5);

In my head, the plan always was the following: Get rid of this call to  
SearchMan.addDirectory() in base/main.cpp (maybe even all of them).  
Instead, let's add a virtual method "initPaths" or "setupPaths" to  
class Engine, which by default contains these calls to  
SearchMan.addDirectory, and which subclasses overload as desired  
(essentially moving all Engine specific calls to  
SearchMan.addDirectory() there). Then invoke that method from  
runGame() in base/main.cpp instead of the addDirectory calls there.


Bye,
Max




More information about the Scummvm-devel mailing list