| 33 | constexpr TStaticBuf BuildRoot = STATIC_BUF(Y_STRINGIZE(ARCADIA_BUILD_ROOT)); |
| 34 | |
| 35 | constexpr Y_FORCE_INLINE bool IsProperPrefix(const TStaticBuf prefix, const TStaticBuf string) noexcept { |
| 36 | if (prefix.Len < string.Len) { |
| 37 | for (unsigned i = prefix.Len; i-- > 0;) { |
| 38 | if (prefix.Data[i] != string.Data[i]) { |
| 39 | #if defined(_MSC_VER) && !defined(__clang__) |
| 40 | // cl.exe uses back slashes for __FILE__ but ARCADIA_ROOT, ARCADIA_BUILD_ROOT are |
| 41 | // defined with forward slashes |
| 42 | if ((prefix.Data[i] == '/') && (string.Data[i] == '\\')) { |
| 43 | continue; |
| 44 | } |
| 45 | #endif |
| 46 | return false; |
| 47 | } |
| 48 | } |
| 49 | return true; |
| 50 | } else { |
| 51 | return false; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | constexpr unsigned RootPrefixLength(const TStaticBuf& f) noexcept { |
| 56 | if (IsProperPrefix(ArcRoot, f)) { |
no outgoing calls
no test coverage detected