Returns true if the path starts with \??\, which is indicative of an NT path
but is not enough to fully distinguish between NT paths and Win32 paths, as
\??\ is not actually a distinct prefix but rather the path to a special virtual
folder in the Object Manager.
For example, \Device\HarddiskVolume2 and \DosDevices\C: are also NT paths but
cannot be distinguished as such by their prefix.
So, inferring whether a path is an NT path or a Win32 path is usually a mistake; that information should instead be known ahead-of-time.
If T is u16, then path should be encoded as WTF-16LE.
pub fn hasCommonNtPrefix(comptime T: type, path: []const T) bool
pub fn hasCommonNtPrefix(comptime T: type, path: []const T) bool {
// Must be exactly \??\, forward slashes are not allowed
const expected_wtf8_prefix = "\\??\\";
const expected_prefix = switch (T) {
u8 => expected_wtf8_prefix,
u16 => std.unicode.wtf8ToWtf16LeStringLiteral(expected_wtf8_prefix),
else => @compileError("unsupported type: " ++ @typeName(T)),
};
return mem.startsWith(T, path, expected_prefix);
}