Opened 8 years ago
Last modified 3 years ago
#6809 new defect
BASE: FSNode's getParent()->getName() is inconsistent.
|Reported by:||somaen||Owned by:|
While looking at https://sourceforge.net/p/scummvm/bugs/6655/ 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 , 8 years ago
|Game:||Zork Grand Inquisitor|
comment:2 by , 5 years ago
comment:3 by , 3 years ago
|Summary:||FSNode's getParent()->getName() is inconsistent. → BASE: FSNode's getParent()->getName() is inconsistent.|