Make FSNodeZIP::exists() actually inspect the ZIP contents, and not just the ZIP file itself.

This fixes issues with checking for a .pro file in a ZIP file always being true, even if there isn't one.
This commit is contained in:
Stephen Anthony 2020-07-27 23:27:21 -02:30
parent 03bae167a2
commit 28751b0732
3 changed files with 16 additions and 2 deletions

View File

@ -126,6 +126,21 @@ void FilesystemNodeZIP::setFlags(const string& zipfile,
_error = zip_error::NOT_READABLE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeZIP::exists() const
{
if(_realNode && _realNode->exists())
{
// We need to inspect the actual path, not just the ZIP file itself
myZipHandler->open(_zipFile);
while(myZipHandler->hasNext())
if(BSPF::startsWithIgnoreCase(myZipHandler->next(), _virtualPath))
return true;
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
{

View File

@ -42,7 +42,7 @@ class FilesystemNodeZIP : public AbstractFSNode
*/
explicit FilesystemNodeZIP(const string& path);
bool exists() const override { return _realNode && _realNode->exists(); }
bool exists() const override;
const string& getName() const override { return _name; }
void setName(const string& name) override { _name = name; }
const string& getPath() const override { return _path; }

View File

@ -184,7 +184,6 @@ void PropertiesSet::loadPerROM(const FilesystemNode& rom, const string& md5)
// First, does this ROM have a per-ROM properties entry?
// If so, load it into the database
FilesystemNode propsNode(rom.getPathWithExt(".pro"));
if(propsNode.exists())
load(propsNode, false);