svn-id: r48041
This commit is contained in:
Max Horn 2010-02-13 11:57:01 +00:00
parent 8ac5d00d57
commit 0a13162073
2 changed files with 14 additions and 23 deletions

View File

@ -49,17 +49,17 @@ FSNode::FSNode(const Common::String &p) {
}
bool FSNode::operator<(const FSNode& node) const {
// Directories come before files, i.e., are "lower".
if (isDirectory() != node.isDirectory())
return isDirectory();
// If both nodes are of the same type (two files or two dirs),
// then sort by name, ignoring case.
return getDisplayName().compareToIgnoreCase(node.getDisplayName()) < 0;
}
bool FSNode::exists() const {
if (_realNode == 0)
return false;
return _realNode->exists();
return _realNode && _realNode->exists();
}
FSNode FSNode::getChild(const Common::String &n) const {
@ -116,24 +116,15 @@ Common::String FSNode::getPath() const {
}
bool FSNode::isDirectory() const {
if (_realNode == 0)
return false;
return _realNode->isDirectory();
return _realNode && _realNode->isDirectory();
}
bool FSNode::isReadable() const {
if (_realNode == 0)
return false;
return _realNode->isReadable();
return _realNode && _realNode->isReadable();
}
bool FSNode::isWritable() const {
if (_realNode == 0)
return false;
return _realNode->isWritable();
return _realNode && _realNode->isWritable();
}
Common::SeekableReadStream *FSNode::createReadStream() const {

View File

@ -101,7 +101,7 @@ public:
*
* @return bool true if the node exists, false otherwise.
*/
virtual bool exists() const;
bool exists() const;
/**
* Create a new node referring to a child node of the current node, which
@ -128,7 +128,7 @@ public:
*
* @return true if successful, false otherwise (e.g. when the directory does not exist).
*/
virtual bool getChildren(FSList &fslist, ListMode mode = kListDirectoriesOnly, bool hidden = false) const;
bool getChildren(FSList &fslist, ListMode mode = kListDirectoriesOnly, bool hidden = false) const;
/**
* Return a human readable string for this node, usable for display (e.g.
@ -161,7 +161,7 @@ public:
*
* @return the 'path' represented by this filesystem node
*/
virtual String getPath() const;
String getPath() const;
/**
* Get the parent node of this node. If this node has no parent node,
@ -178,7 +178,7 @@ public:
* Or even replace isDirectory by a getType() method that can return values like
* kDirNodeType, kFileNodeType, kInvalidNodeType.
*/
virtual bool isDirectory() const;
bool isDirectory() const;
/**
* Indicates whether the object referred by this node can be read from or not.
@ -191,7 +191,7 @@ public:
*
* @return true if the object can be read, false otherwise.
*/
virtual bool isReadable() const;
bool isReadable() const;
/**
* Indicates whether the object referred by this node can be written to or not.
@ -204,7 +204,7 @@ public:
*
* @return true if the object can be written to, false otherwise.
*/
virtual bool isWritable() const;
bool isWritable() const;
/**
* Creates a SeekableReadStream instance corresponding to the file
@ -222,7 +222,7 @@ public:
*
* @return pointer to the stream object, 0 in case of a failure
*/
virtual WriteStream *createWriteStream() const;
WriteStream *createWriteStream() const;
};
/**