Deprecated; see parsePathWindows
pub fn windowsParsePath(path: []const u8) WindowsPath
pub fn windowsParsePath(path: []const u8) WindowsPath {
if (path.len >= 2 and path[1] == ':') {
return WindowsPath{
.is_abs = isAbsoluteWindows(path),
.kind = WindowsPath.Kind.Drive,
.disk_designator = path[0..2],
};
}
if (path.len >= 1 and (path[0] == '/' or path[0] == '\\') and
(path.len == 1 or (path[1] != '/' and path[1] != '\\')))
{
return WindowsPath{
.is_abs = true,
.kind = WindowsPath.Kind.None,
.disk_designator = path[0..0],
};
}
const relative_path = WindowsPath{
.kind = WindowsPath.Kind.None,
.disk_designator = &[_]u8{},
.is_abs = false,
};
if (path.len >= 2 and PathType.windows.isSep(u8, path[0]) and PathType.windows.isSep(u8, path[1])) {
const root_end = root_end: {
var server_end = mem.findAnyPos(u8, path, 2, "/\\") orelse break :root_end path.len;
while (server_end < path.len and PathType.windows.isSep(u8, path[server_end])) server_end += 1;
break :root_end mem.findAnyPos(u8, path, server_end, "/\\") orelse path.len;
};
return WindowsPath{
.is_abs = true,
.kind = WindowsPath.Kind.NetworkShare,
.disk_designator = path[0..root_end],
};
}
return relative_path;
}