Last path component, verbatim (keeps the '@' and case). Handles both '/' and '\' regardless of host OS so a mount-path string round-trips identically everywhere (mount paths are native — '\' on Windows — but the unit tests pin both forms).
| 78 | // Last path component, verbatim (keeps the '@' and case). Handles both '/' and '\' |
| 79 | // regardless of host OS so a mount-path string round-trips identically everywhere |
| 80 | // (mount paths are native — '\' on Windows — but the unit tests pin both forms). |
| 81 | std::string FolderBasename(const std::string& path) |
| 82 | { |
| 83 | std::string p = path; |
| 84 | while (!p.empty() && (p.back() == '/' || p.back() == '\\')) |
| 85 | p.pop_back(); |
| 86 | const std::size_t slash = p.find_last_of("/\\"); |
| 87 | return (slash == std::string::npos) ? p : p.substr(slash + 1); |
| 88 | } |
| 89 | |
| 90 | std::string Trim(std::string s) |
no test coverage detected