def check_path()

in dynalab_cli/utils.py [0:0]


def check_path(path, root_dir=".", is_file=True, allow_empty=True):
    if not path:
        return False
    if not os.path.exists(path):
        return False
    if is_file and not os.path.isfile(path):
        return False
    if not allow_empty and os.path.getsize(path) == 0:
        return False
    return os.path.realpath(path).startswith(os.path.realpath(root_dir))