Opened 4 years ago

Last modified 3 months ago

#6809 new defect

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

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


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 (2)

comment:1 Changed 4 years ago by somaen

Component: Engine: ZVision
Game: Zork Grand Inquisitor

comment:2 Changed 3 months ago by digitall

Component: --Other--
Note: See TracTickets for help on using tickets.