| 124 | } |
| 125 | |
| 126 | void PathUtils::splitLastComponent(PathName& path, PathName& file, |
| 127 | const PathName& orgPath) |
| 128 | { |
| 129 | PathName::size_type pos = orgPath.rfind(dir_sep); |
| 130 | if (pos == PathName::npos) |
| 131 | { |
| 132 | path = ""; |
| 133 | file = orgPath; |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | path.erase(); |
| 138 | path.append(orgPath, 0, pos); // skip the directory separator |
| 139 | file.erase(); |
| 140 | file.append(orgPath, pos + 1, orgPath.length() - pos - 1); |
| 141 | } |
| 142 | |
| 143 | void PathUtils::splitPrefix(PathName& path, PathName& prefix) |
| 144 | { |