TODO: Test this...
| 131 | |
| 132 | // TODO: Test this... |
| 133 | uint32_t GetCanonicalPathFromBase(const char* base_dir, const char* relative_dir, char* buf, uint32_t buf_len) |
| 134 | { |
| 135 | dmSnPrintf(buf, buf_len, "%s/%s", base_dir, relative_dir); |
| 136 | |
| 137 | char* source = buf; |
| 138 | char* dest = buf; |
| 139 | char last_c = 0; |
| 140 | while (*source != 0) |
| 141 | { |
| 142 | char c = *source; |
| 143 | if (c != '/' || (c == '/' && last_c != '/')) |
| 144 | *dest++ = c; |
| 145 | |
| 146 | last_c = c; |
| 147 | ++source; |
| 148 | } |
| 149 | *dest = '\0'; |
| 150 | return (uint32_t)(dest - buf); |
| 151 | } |
| 152 | |
| 153 | uint32_t GetCanonicalPath(const char* relative_dir, char* buf, uint32_t buf_len) |
| 154 | { |
no test coverage detected