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

Ori Avtalion ori at avtalion.name
Mon Dec 1 18:26:00 CET 2008


Hi all,

The KoM engine's FLIC player was recently merged into ScummVM. To
celebrate the occasion, I tried adjusting my engine to work with it.

Since the API involved strings of filenames (via File::open) instead of
FSNodes, I realized that I had made an error: I have always used
Engine::_gameDataDir and lots of getChild()'s to create FSNode's to
specific files, like so:

   _gameDataDir.getChild("kom").getChild("oneoffs").getChild("pan1.img")

That same class member has a "FIXME: Get rid of this" right next to it :)

So I have begun phasing out the use of _gameDataDir and replace it with
strings in the form of "kom/oneoffs/pan1.img" when I reached a roadblock.

The KoM directory structure contains files 4 directories deep into the
tree. (Some of the files have the same names so I can't use
addDefaultDirectory.)

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?

Thanks!
-Ori




More information about the Scummvm-devel mailing list