mirror of https://github.com/stella-emu/stella.git
We don't need to check for directory, since we're using FSNode::ListMode::FilesOnly.
This commit is contained in:
parent
8f8efafd98
commit
477c800d0e
|
@ -187,10 +187,12 @@ bool RomImageWidget::getImageList(const string& propname, const string& filename
|
||||||
FSNode::NameFilter filter = ([&](const FSNode& node)
|
FSNode::NameFilter filter = ([&](const FSNode& node)
|
||||||
{
|
{
|
||||||
const string& nodeName = node.getName();
|
const string& nodeName = node.getName();
|
||||||
return (!node.isDirectory() &&
|
return
|
||||||
(nodeName == pngPropName || nodeName == pngFileName ||
|
(nodeName == pngPropName || nodeName == pngFileName ||
|
||||||
(nodeName.find(propname + " #") == 0 && nodeName.find(".png") == nodeName.length() - 4) ||
|
(nodeName.find(propname + " #") == 0 &&
|
||||||
(nodeName.find(filename + " #") == 0 && nodeName.find(".png") == nodeName.length() - 4)));
|
nodeName.find(".png") == nodeName.length() - 4) ||
|
||||||
|
(nodeName.find(filename + " #") == 0 &&
|
||||||
|
nodeName.find(".png") == nodeName.length() - 4));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -198,7 +200,8 @@ bool RomImageWidget::getImageList(const string& propname, const string& filename
|
||||||
FSNode node(instance().snapshotLoadDir().getPath());
|
FSNode node(instance().snapshotLoadDir().getPath());
|
||||||
node.getChildren(myImageList, FSNode::ListMode::FilesOnly, filter, false, false);
|
node.getChildren(myImageList, FSNode::ListMode::FilesOnly, filter, false, false);
|
||||||
|
|
||||||
// Sort again, not considering extensions, else <filename.png> would be at the end of the list
|
// Sort again, not considering extensions, else <filename.png> would be at
|
||||||
|
// the end of the list
|
||||||
std::sort(myImageList.begin(), myImageList.end(),
|
std::sort(myImageList.begin(), myImageList.end(),
|
||||||
[](const FSNode& node1, const FSNode& node2)
|
[](const FSNode& node1, const FSNode& node2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include "TimerManager.hxx"
|
||||||
|
|
||||||
#if defined(RETRON77)
|
#if defined(RETRON77)
|
||||||
#define ROOT_DIR "/mnt/games/"
|
#define ROOT_DIR "/mnt/games/"
|
||||||
#else
|
#else
|
||||||
|
@ -101,7 +103,10 @@ bool FSNodePOSIX::hasParent() const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
{
|
{
|
||||||
assert(_isDirectory);
|
uInt64 T = TimerManager::getTicks();
|
||||||
|
|
||||||
|
if (!_isDirectory)
|
||||||
|
return false;
|
||||||
|
|
||||||
DIR* dirp = opendir(_path.c_str());
|
DIR* dirp = opendir(_path.c_str());
|
||||||
if (dirp == nullptr)
|
if (dirp == nullptr)
|
||||||
|
@ -122,16 +127,6 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
|
|
||||||
FSNodePOSIX entry(newPath, false);
|
FSNodePOSIX entry(newPath, false);
|
||||||
|
|
||||||
#if defined(SYSTEM_NOT_SUPPORTING_D_TYPE)
|
|
||||||
/* TODO: d_type is not part of POSIX, so it might not be supported
|
|
||||||
* on some of our targets. For those systems where it isn't supported,
|
|
||||||
* add this #elif case, which tries to use stat() instead.
|
|
||||||
*
|
|
||||||
* The d_type method is used to avoid costly recurrent stat() calls in big
|
|
||||||
* directories.
|
|
||||||
*/
|
|
||||||
entry.setFlags();
|
|
||||||
#else
|
|
||||||
if (dp->d_type == DT_UNKNOWN)
|
if (dp->d_type == DT_UNKNOWN)
|
||||||
{
|
{
|
||||||
// Fall back to stat()
|
// Fall back to stat()
|
||||||
|
@ -161,7 +156,6 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
|
|
||||||
entry._isValid = true;
|
entry._isValid = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skip files that are invalid for some reason (e.g. because we couldn't
|
// Skip files that are invalid for some reason (e.g. because we couldn't
|
||||||
// properly stat them).
|
// properly stat them).
|
||||||
|
@ -177,6 +171,7 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
|
||||||
|
cerr << (TimerManager::getTicks() - T) << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue