def path_ndir_split(path_, n, force_unix=True, winroot='C:', trailing=True):
    r
    if not isinstance(path_, six.string_types):
        return path_
    if n is None:
        cplat_path = ensure_crossplat_path(path_)
    elif n == 0:
        cplat_path = ''
    else:
        sep = '/' if force_unix else os.sep
        ndirs_list = []
        head = path_
        reached_end = False
        for nx in range(n):
            head, tail = split(head)
            if tail == '':
                if head == '':
                    reached_end = True
                else:
                    root = head if len(ndirs_list) == 0 else head.strip('\\/')
                    ndirs_list.append(root)
                    reached_end = True
                break
            else:
                ndirs_list.append(tail)
        if trailing and not reached_end:
            head, tail = split(head)
            if len(tail) == 0:
                if len(head) == 0:
                    reached_end = True
        ndirs = sep.join(ndirs_list[::-1])
        cplat_path = ensure_crossplat_path(ndirs)
        if trailing and not reached_end:
            cplat_path = '.../' + cplat_path
    return cplat_path