| 77 | #endif |
| 78 | |
| 79 | static size_t findRootLength(StringSpan path) |
| 80 | { |
| 81 | const native_char_t* text = path.getNullTerminatedNative(); |
| 82 | const size_t length = nativeLength(path); |
| 83 | if (text == nullptr || length == 0) |
| 84 | return 0; |
| 85 | #if SC_PLATFORM_WINDOWS |
| 86 | if (length >= 4 && isSeparator(text[0]) && isSeparator(text[1]) && text[2] == static_cast<native_char_t>('?') && |
| 87 | isSeparator(text[3])) |
| 88 | { |
| 89 | return 4; |
| 90 | } |
| 91 | if (length >= 3 && isAsciiAlpha(text[0]) && text[1] == static_cast<native_char_t>(':') && isSeparator(text[2])) |
| 92 | { |
| 93 | return 3; |
| 94 | } |
| 95 | if (length >= 2 && isSeparator(text[0]) && isSeparator(text[1])) |
| 96 | { |
| 97 | size_t idx = 2; |
| 98 | while (idx < length && !isSeparator(text[idx])) |
| 99 | idx++; |
| 100 | if (idx >= length) |
| 101 | return 2; |
| 102 | idx++; |
| 103 | while (idx < length && !isSeparator(text[idx])) |
| 104 | idx++; |
| 105 | return idx; |
| 106 | } |
| 107 | return 0; |
| 108 | #else |
| 109 | return text[0] == '/' ? 1 : 0; |
| 110 | #endif |
| 111 | } |
| 112 | |
| 113 | static bool isAbsoluteNative(StringSpan path) { return findRootLength(path) > 0; } |
| 114 |
no test coverage detected