| 102 | } |
| 103 | |
| 104 | void reduce(DynamicString &clean, const char *path) |
| 105 | { |
| 106 | if (path == NULL) |
| 107 | return; |
| 108 | |
| 109 | char cc = any_separator(*path) ? PATH_SEPARATOR : *path; |
| 110 | clean += cc; |
| 111 | ++path; |
| 112 | |
| 113 | for (; *path; ++path) { |
| 114 | if (cc == PATH_SEPARATOR && any_separator(*path)) |
| 115 | continue; |
| 116 | |
| 117 | cc = any_separator(*path) ? PATH_SEPARATOR : *path; |
| 118 | clean += cc; |
| 119 | } |
| 120 | |
| 121 | if (has_trailing_separator(clean.c_str())) |
| 122 | array::pop_back(clean._data); |
| 123 | } |
| 124 | |
| 125 | bool expand(DynamicString &expanded, const char *path_template) |
| 126 | { |