[Scummvm-devel] small FilesystemNode changes (Porters should also read this!)

Johannes Schickel lordhoto at gmail.com
Sat Jul 22 20:44:21 CEST 2006


A follow up since sev asked me about what code is bad for example.
One very easy example is you have a file 'FOO' (or you assume to have),
maybe it's even in a path added with File::addDirectoryRecursive. If
you now do:

FilesystemNode file("FOO")

// either this
Common::File f;
f.open(file);

// or this
md5_file(f, /*some other params here*/);

or any other operation which with the FilesystemNode it could simply
fail, maybe even trigger an assertion since name/displayName/path do not
work on invalid FilesystemNodes.

Also notice that file system nodes are *not* handled case sensitive
at the time for writing, nor do they check any path added by
File::addDirectoryRecursive.

So if you work with FilesystemNode be sure to use isValid before you
make any usage of it. Then again it would be nice to rework
FilesystemNode and maybe Common::File in the future.

// Johannes

PS: if something is unclear please ask.




More information about the Scummvm-devel mailing list