| 41 | } |
| 42 | |
| 43 | void Normalize(const char* path, char* out, uint32_t out_size) |
| 44 | { |
| 45 | assert(out_size > 0); |
| 46 | |
| 47 | uint32_t i = 0; |
| 48 | while (*path && i < out_size) |
| 49 | { |
| 50 | int c = *path; |
| 51 | if (c == '/' || c == '\\') |
| 52 | { |
| 53 | out[i] = '/'; |
| 54 | path = SkipSlashes(path); |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | out[i] = c; |
| 59 | ++path; |
| 60 | } |
| 61 | |
| 62 | ++i; |
| 63 | } |
| 64 | |
| 65 | if (i > 1 && out[i-1] == '/') |
| 66 | { |
| 67 | // Remove trailing / |
| 68 | out[i-1] = '\0'; |
| 69 | } |
| 70 | |
| 71 | out[dmMath::Min(i, out_size-1)] = '\0'; |
| 72 | } |
| 73 | |
| 74 | void NormalizeW(const wchar_t* path, wchar_t* out, uint32_t out_size) |
| 75 | { |