mirror of https://github.com/stella-emu/stella.git
Some small API changes for FSNode::getChildren(); it should only include the parent if requested.
This commit is contained in:
parent
1504e81706
commit
ced671c972
|
@ -47,7 +47,8 @@ bool FilesystemNode::exists() const
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
|
bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
|
||||||
const NameFilter& filter) const
|
const NameFilter& filter,
|
||||||
|
bool includeParentDirectory) const
|
||||||
{
|
{
|
||||||
if (!_realNode || !_realNode->isDirectory())
|
if (!_realNode || !_realNode->isDirectory())
|
||||||
return false;
|
return false;
|
||||||
|
@ -83,7 +84,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add parent node, if it is valid to do so
|
// Add parent node, if it is valid to do so
|
||||||
if (hasParent())
|
if (includeParentDirectory && hasParent())
|
||||||
{
|
{
|
||||||
FilesystemNode parent = getParent();
|
FilesystemNode parent = getParent();
|
||||||
parent.setName(" [..]");
|
parent.setName(" [..]");
|
||||||
|
|
|
@ -134,7 +134,8 @@ class FilesystemNode
|
||||||
* does not exist).
|
* does not exist).
|
||||||
*/
|
*/
|
||||||
bool getChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
|
bool getChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
|
||||||
const NameFilter& filter = [](const FilesystemNode&){ return true; }) const;
|
const NameFilter& filter = [](const FilesystemNode&){ return true; },
|
||||||
|
bool includeParentDirectory = true) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get a string representation of the name of the file. This is can be
|
* Set/get a string representation of the name of the file. This is can be
|
||||||
|
|
|
@ -159,7 +159,7 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) con
|
||||||
if (entry._isDirectory)
|
if (entry._isDirectory)
|
||||||
entry._path += "/";
|
entry._path += "/";
|
||||||
|
|
||||||
entry._isValid = entry._isDirectory || entry._isFile;
|
entry._isValid = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue