Some small API changes for FSNode::getChildren(); it should only include the parent if requested.

This commit is contained in:
Stephen Anthony 2020-05-30 22:03:10 -02:30
parent 1504e81706
commit ced671c972
3 changed files with 6 additions and 4 deletions

View File

@ -47,7 +47,8 @@ bool FilesystemNode::exists() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
const NameFilter& filter) const
const NameFilter& filter,
bool includeParentDirectory) const
{
if (!_realNode || !_realNode->isDirectory())
return false;
@ -83,7 +84,7 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode,
);
// Add parent node, if it is valid to do so
if (hasParent())
if (includeParentDirectory && hasParent())
{
FilesystemNode parent = getParent();
parent.setName(" [..]");

View File

@ -134,7 +134,8 @@ class FilesystemNode
* does not exist).
*/
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

View File

@ -159,7 +159,7 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) con
if (entry._isDirectory)
entry._path += "/";
entry._isValid = entry._isDirectory || entry._isFile;
entry._isValid = true;
}
#endif