[Scummvm-devel] FilesystemNode behavior changes

Max Horn max at quendi.de
Sat May 13 04:58:40 CEST 2006


Hi there,

this concerns everybody who wants to use FilesystemNode: Last night I  
changed its semantics a bit.

So far, the default FilesystemNode constructor would construct a node  
that pointed to the root directory (or, in the recent past and for  
the POSIX FS module, a node that pointed to the "current directory"):

Obviously, that was a quite arbitrary choice, but still some code  
relied on this. I now changed this: The default FilesystemNode now  
creates an *invalid* node. This saves some overhead and makes sure  
one doesn't use the FilesystemNode w/o properly initializing it.


At the same time, I changed the FilesystemNode(String) constructor.  
You are now allowed to pass an empty string to it, or the string ".".  
In both cases, it will detect this and call  
AbstractFilesystemNode::getCurrentDirectory() to create a node  
referring to the, well, current directory. For most ports, that  
currently just returns the root node. But for the POSIX backend, it's  
really the current directory.

This (hopefully) simplifies usage of the "path" config variable. For  
example, the ScummEngine code used to do this:
        FilesystemNode dir;
        if (ConfMan.hasKey("path") )
                dir = FilesystemNode(ConfMan.get("path"));
which no was simplified to this
	FilesystemNode dir(ConfMan.get("path"));
Yeah yeah, nothing big, but it's still easier, and less prone to  
accidental mistakes or differences (like forgetting to make that  
check, or by handling a missing "path" differently).


Cheers,
Max




More information about the Scummvm-devel mailing list