[Scummvm-devel] SearchMan contains each file in the current directory twice

Max Horn max at quendi.de
Sun Jan 31 12:08:23 CET 2010


Am 27.01.2010 um 22:50 schrieb Sven Hesse:

> On 2010-01-27 21:46:24 +0000, Sven Hesse wrote:
>> while digging through SCI weirdness with clone, we noticed that
>> SearchMan contains all files in the current directory twice.
>
> Ah, actually, right after sending the mail, I noticed the real deal:
> One adds the /current/ directoy, one the /game/ directory. And I've
> been running the game from the command line with -p, without adding it
> to my ~/.scummvmrc.
>
> So, there probably should be a check whether the current directory is
> the game directory to prevent this from happening?

SearchMan already checks whether an archive being added is already in  
the list of dirs, but only does so by checking the "name" of the dir.  
It doesn't attempt to check whether e.g. "current dir" == "/some/other/ 
path", and how could it, as deciding this is highly non-portable and  
not that easy to start with either. (Let's not forget about comparing  
things like "/some/path" and "/some/indirect/../path", which point to  
the same dir, too; or on Linux, there could be hard links and sym  
links...).

So, if such a check was to be added, then it would have to be  
performed by FSNode, somehow, by adding a suitable operator== to it.  
Then Common::Archive would need an operator==, too, in general (and  
being able to compare different subclasses; think RTTI...);  And  
moreover, Common::SearchSet would have to be made aware of this and  
compare a newly added archive to all previously added archive.

This adds a lot of complexity to the code, only to catch a border  
case, which most likely only a few devs ever hit... Personally, I am  
not convinced that it would be worth it. But maybe you or others see  
strong reasons why it should be changed; or maybe there is a trivial  
way to do it that I am overlooking.

Bye,
Max




More information about the Scummvm-devel mailing list