diff options
| author | Max Horn | 2006-04-30 22:52:10 +0000 |
|---|---|---|
| committer | Max Horn | 2006-04-30 22:52:10 +0000 |
| commit | 8300d1d2a921dc5aebb855ebc404ba0957e4435a (patch) | |
| tree | 47818b2494d6a2013f4745bf47334852ed4c3eaf /backends/fs/fs.cpp | |
| parent | 8542e92ed37af3383123b19edd930db65cd81c56 (diff) | |
| download | scummvm-rg350-8300d1d2a921dc5aebb855ebc404ba0957e4435a.tar.gz scummvm-rg350-8300d1d2a921dc5aebb855ebc404ba0957e4435a.tar.bz2 scummvm-rg350-8300d1d2a921dc5aebb855ebc404ba0957e4435a.zip | |
Added new AbstractFilesystemNode::child() resp. FilesystemNode::getChild() methods
svn-id: r22249
Diffstat (limited to 'backends/fs/fs.cpp')
| -rw-r--r-- | backends/fs/fs.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/backends/fs/fs.cpp b/backends/fs/fs.cpp index 445bea8efe..4907e78ee6 100644 --- a/backends/fs/fs.cpp +++ b/backends/fs/fs.cpp @@ -84,6 +84,9 @@ FilesystemNode &FilesystemNode::operator =(const FilesystemNode &node) { } FilesystemNode FilesystemNode::getParent() const { + if (_realNode == 0) + return *this; + AbstractFilesystemNode *node = _realNode->parent(); if (node == 0) { return *this; @@ -92,22 +95,39 @@ FilesystemNode FilesystemNode::getParent() const { } } +FilesystemNode FilesystemNode::getChild(const String &name) const { + if (_realNode == 0) + return *this; + + assert(_realNode->isDirectory()); + AbstractFilesystemNode *node = _realNode->child(name); + return AbstractFilesystemNode::wrap(node); +} + +FSList FilesystemNode::listDir(ListMode mode) const { + assert(_realNode); + assert(_realNode->isDirectory()); + return _realNode->listDir(mode); +} + Common::String FilesystemNode::displayName() const { + assert(_realNode); return _realNode->displayName(); } bool FilesystemNode::isValid() const { + if (_realNode == 0) + return false; return _realNode->isValid(); } bool FilesystemNode::isDirectory() const { + if (_realNode == 0) + return false; return _realNode->isDirectory(); } Common::String FilesystemNode::path() const { + assert(_realNode); return _realNode->path(); } - -FSList FilesystemNode::listDir(ListMode mode) const { - return _realNode->listDir(mode); -} |
