mirror of https://github.com/stella-emu/stella.git
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:
parent
68d977b49b
commit
b6638540c7
|
@ -126,6 +126,21 @@ void FilesystemNodeZIP::setFlags(const string& zipfile,
|
||||||
_error = zip_error::NOT_READABLE;
|
_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
|
bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ class FilesystemNodeZIP : public AbstractFSNode
|
||||||
*/
|
*/
|
||||||
explicit FilesystemNodeZIP(const string& path);
|
explicit FilesystemNodeZIP(const string& path);
|
||||||
|
|
||||||
bool exists() const override { return _realNode && _realNode->exists(); }
|
bool exists() const override;
|
||||||
const string& getName() const override { return _name; }
|
const string& getName() const override { return _name; }
|
||||||
void setName(const string& name) override { _name = name; }
|
void setName(const string& name) override { _name = name; }
|
||||||
const string& getPath() const override { return _path; }
|
const string& getPath() const override { return _path; }
|
||||||
|
|
|
@ -184,7 +184,6 @@ void PropertiesSet::loadPerROM(const FilesystemNode& rom, const string& md5)
|
||||||
// First, does this ROM have a per-ROM properties entry?
|
// First, does this ROM have a per-ROM properties entry?
|
||||||
// If so, load it into the database
|
// If so, load it into the database
|
||||||
FilesystemNode propsNode(rom.getPathWithExt(".pro"));
|
FilesystemNode propsNode(rom.getPathWithExt(".pro"));
|
||||||
|
|
||||||
if(propsNode.exists())
|
if(propsNode.exists())
|
||||||
load(propsNode, false);
|
load(propsNode, false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue