WINTERMUTE: Simplify getNodeForRelativePath

This commit is contained in:
Einar Johan Trøan Sømåen 2012-08-31 16:34:12 +02:00
parent 764ca7a51a
commit 71981aaecf

View File

@ -71,14 +71,11 @@ static Common::FSNode getNodeForRelativePath(const Common::String &filename) {
// Get the next path-component by slicing on '\\'
Common::String pathPart = path.nextToken();
// Get the next FSNode in the chain, if it exists as a child from the previous.
Common::FSNode nextNode(curNode.getChild(pathPart));
if (!nextNode.exists()) {
curNode = curNode.getChild(pathPart);
if (!curNode.isReadable()) {
// Return an invalid FSNode.
return Common::FSNode();
}
if (nextNode.exists() && nextNode.isReadable()) {
curNode = nextNode;
}
// Following the comments in common/fs.h, anything not a directory is a file.
if (!curNode.isDirectory()) {
if (!path.empty()) {