Fix opening ZIP files that don't contain any ROMs.

This commit is contained in:
Stephen Anthony 2019-08-14 15:05:21 -02:30
parent 3763431064
commit b9e6a69de8
2 changed files with 2 additions and 8 deletions

View File

@ -58,13 +58,11 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
// TODO: Actually present the error passed in back to the user
// For now, we just indicate that no ROMs were found
_error = zip_error::NO_ROMS;
return;
}
_numFiles = myZipHandler->romFiles();
if(_numFiles == 0)
{
_error = zip_error::NO_ROMS;
return;
}
// We always need a virtual file/path
@ -92,7 +90,7 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
if(!found)
return;
}
else
else if(_numFiles > 1)
_isDirectory = true;
// Create a concrete FSNode to use
@ -137,7 +135,6 @@ void FilesystemNodeZIP::setFlags(const string& zipfile,
}
_name = lastPathComponent(_path);
_error = zip_error::NONE;
if(!_realNode->isFile())
_error = zip_error::NOT_A_FILE;
if(!_realNode->isReadable())

View File

@ -89,10 +89,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode) const
// Force ZIP c'tor to be called
AbstractFSNodePtr ptr = FilesystemNodeFactory::create(i->getPath(),
FilesystemNodeFactory::Type::ZIP);
if (ptr->getName() != EmptyString)
fslist.emplace_back(FilesystemNode(ptr));
else
fslist.emplace_back(FilesystemNode(i));
fslist.emplace_back(FilesystemNode(ptr));
}
else
#endif