aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/psp/psp-fs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/fs/psp/psp-fs.cpp')
-rw-r--r--backends/fs/psp/psp-fs.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp
index 3fe6060928..aa3e253782 100644
--- a/backends/fs/psp/psp-fs.cpp
+++ b/backends/fs/psp/psp-fs.cpp
@@ -71,30 +71,6 @@ public:
virtual AbstractFilesystemNode *getParent() const;
};
-/**
- * Returns the last component of a given path.
- *
- * Examples:
- * /foo/bar.txt would return /bar.txt
- * /foo/bar/ would return /bar/
- *
- * @param str String containing the path.
- * @return Pointer to the first char of the last component inside str.
- */
-const char *lastPathComponent(const Common::String &str) {
- if(str.empty())
- return "";
-
- const char *start = str.c_str();
- const char *cur = start + str.size() - 2;
-
- while (cur >= start && *cur != '/') {
- --cur;
- }
-
- return cur + 1;
-}
-
PSPFilesystemNode::PSPFilesystemNode() {
_isDirectory = true;
_displayName = "Root";
@@ -106,7 +82,7 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
assert(p.size() > 0);
_path = p;
- _displayName = lastPathComponent(_path);
+ _displayName = lastPathComponent(_path, '/');
_isValid = true;
_isDirectory = true;
@@ -176,7 +152,7 @@ AbstractFilesystemNode *PSPFilesystemNode::getParent() const {
return 0;
const char *start = _path.c_str();
- const char *end = lastPathComponent(_path);
+ const char *end = lastPathComponent(_path, '/');
return new PSPFilesystemNode(String(start, end - start), false);
}