Logo Search packages:      
Sourcecode: scummvm version File versions

const char * AbstractFSNode::lastPathComponent ( const Common::String str,
const char  sep 
) [static, protected, inherited]

Returns the last component of a given path.

Examples: /foo/bar.txt would return /bar.txt /foo/bar/ would return /bar/

Parameters:
strString containing the path.
sepcharacter used to separate path components
Returns:
Pointer to the first char of the last component inside str.

Definition at line 27 of file abstract-fs.cpp.

Referenced by RoninCDFileNode::getName(), and RoninCDFileNode::getParent().

                                                                                     {
      // TODO: Get rid of this eventually! Use Common::lastPathComponent instead
      if (str.empty())
            return "";

      const char *start = str.c_str();
      const char *cur = start + str.size() - 2;

      while (cur >= start && *cur != sep) {
            --cur;
      }

      return cur + 1;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index