def rmdir(patch, path):
    """
	Remove (delete) the directory path.
	Only works when the directory is empty, otherwise, OSError is raised.
	In order to remove whole directory trees, shutil.rmtree() can be used.
	"""
    ap = os.path.abspath(os.path.join(CWD, path))
    manager = get_manager()
    fsi, relpath, readonly = manager.get_fsi(ap)
    if fsi is None:
        return _org_rmdir(relpath)
    elif readonly:
        raise IOError("[Errno 1] Operation not permitted: '{p}'".format(p=ap))
    else:
        # FSI.remove() works on both files and dirs.
        if os.path.isfile(relpath):
            raise os.error("[Errno 20] Not a directory: '{p}'".format(p=ap))
        try:
            return fsi.remove(relpath)
        except OperationFailure as e:
            raise os.error(e.message)

	Remove (delete) the directory path.
	Only works when the directory is empty, otherwise, OSError is raised.
	In order to remove whole directory trees, shutil.rmtree() can be used.
	
lib/mlpatches/mount_base.py