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

View File

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