* @brief Strips all directories from the given path. * * For example, stripDirs("/home/user/test.c") returns @c "test.c". * * TODO Implement the following functionality: * - paths on MS Windows ('\' vs '/') * - allow backslashed '/' in file names */
| 797 | * - allow backslashed '/' in file names |
| 798 | */ |
| 799 | std::string stripDirs(const std::string &path) { |
| 800 | std::size_t endPos = path.find_last_of('/'); |
| 801 | if (endPos + 1 < path.length()) { |
| 802 | return path.substr(endPos + 1); |
| 803 | } |
| 804 | return path; |
| 805 | } |
| 806 | |
| 807 | /** |
| 808 | * @brief Replaces all occurrences of @a from in @a str with @a to and returns |