Opened 9 years ago

Last modified 4 years ago

#6809 new defect

BASE: FSNode's getParent()->getName() is inconsistent.

Reported by: somaen Owned by:
Priority: normal Component: --Other--
Version: Keywords:
Cc: Game:


While looking at the issue was found to only exist on windows, and ended up being that WME does the following: * Goes through it's paths by way of an FSList-iterator, it. * Then gets the children of that iterator by way of it->getChildren() into another FSList. * Then goes through those files by way of an iterator called fileIt.

(The details can be seen in engines/wintermute/base/base_file_manager.cpp:registerPackages).

To avoid loading the wrong files, a specific name check was then performed on the parent folder, checking whether it was "language" or "languages", so that only i.e. "english.dcp" would be loaded from that folder.

Now, the issue is that the parent folder name was gotten by doing: Common::String parentName = fileIt->getParent().getName();

Which does not seem to get the same result as doing it->getname() on Windows.

The problem is, on Windows the parentName would contain a trailing \, while on OS X that would not be the case.

Windows has: const char start = _path.c_str(); const char end = lastPathComponent(_path, '\');

... p->_path = Common::String(start, end - start);

Posix has: const char start = _path.c_str(); const char end = start + _path.size();

while (end > start && (*end - 1) != '/') end--;

return makeNode(Common::String(start, end));

So, in practice, the problem is two-fold: * node->getChildren()->getParent->getName() from a child does not get the same name as node->getName(). * getParent()->getName() is inconsistent between Win32 and Posix.

Since both of these birds in theory boil down to the same code, I'm posting this as a single bug.

Ticket imported from: bugs/6809.

Change History (3)

comment:1 by somaen, 9 years ago

Component: Engine: ZVision
Game: Zork Grand Inquisitor

comment:2 by digitall, 5 years ago

Component: --Other--

comment:3 by raziel-, 4 years ago

Summary: FSNode's getParent()->getName() is inconsistent.BASE: FSNode's getParent()->getName() is inconsistent.
Note: See TracTickets for help on using tickets.