diff options
Diffstat (limited to 'backends/fs/posix/posix-fs.cpp')
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index efc75bc187..5cd6a909d6 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -37,31 +37,6 @@ #endif - -/** - * 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; -} - void POSIXFilesystemNode::setFlags() { struct stat st; @@ -93,7 +68,7 @@ POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p, bool verify) { _path = p; } - _displayName = lastPathComponent(_path); + _displayName = lastPathComponent(_path, '/'); if (verify) { setFlags(); @@ -224,7 +199,7 @@ AbstractFilesystemNode *POSIXFilesystemNode::getParent() const { return 0; const char *start = _path.c_str(); - const char *end = lastPathComponent(_path); + const char *end = lastPathComponent(_path, '/'); #ifdef __OS2__ if (end == start) |