def selectDir(window, index=-2, level=0, paths=None, key=None, func=None, label=None):
    if index == -1:
        return ''

    if level > 0 and index == 0:
        sel_path = paths[0].split('(')[1][:-1]
        if func:
            if key:
                func(key, sel_path)
        return

    else:
        if index == 1:
            level -= 1
        elif index > 1:
            level += 1

        if level <= 0:
            level = 0
            dir_path = '.'
            parent_path = '..'

            paths = listRootPath()

        else:
            sel_path = paths[index]
            if sel_path == ROOT_PATH:
                sel_path = '/'
            dir_path = os.path.abspath(sel_path)
            parent_path = os.path.join(dir_path, '..')

            cur_dir = Dir(dir_path)
            sub_dirs = cur_dir.listDirs()
            paths = [d.getPath() for d in sub_dirs]

        try:
            from .I18n import I18n
        except:
            from libs.I18n import I18n

        _ = I18n().translate

        paths.insert(0, parent_path)
        paths.insert(0, _('select_cur_dir_{0}', dir_path))

    sublime.set_timeout(lambda: window.show_quick_panel(
        paths, lambda index: selectDir(
            window, index, level, paths, key, func)), 5)
dataset/ETHPy150Open gepd/Deviot/libs/Paths.py/selectDir/original