| 60 | } |
| 61 | |
| 62 | std::string ExtractBaseName(const char* path, bool include_extension) |
| 63 | { |
| 64 | const char* src, * dot; |
| 65 | |
| 66 | src = path + strlen(path) - 1; |
| 67 | |
| 68 | if (src >= path) |
| 69 | { |
| 70 | // back up until a / or the start |
| 71 | while (src != path && src[-1] != '/' && src[-1] != '\\') // check both on all systems for consistent behavior with archives. |
| 72 | src--; |
| 73 | |
| 74 | if (!include_extension && (dot = strrchr(src, '.'))) |
| 75 | { |
| 76 | return std::string(src, dot - src); |
| 77 | } |
| 78 | else |
| 79 | { |
| 80 | return std::string(src); |
| 81 | } |
| 82 | } |
| 83 | return std::string(); |
| 84 | } |
| 85 | |
| 86 | void strReplace(std::string& str, const char *from, const char* to) |
| 87 | { |
no outgoing calls
no test coverage detected