def cmd_rmdir(self, cmdict):
shelf = self._path2shelf(cmdict['path'])
children = self.db.get_directory_shelves(shelf)
self.errno = errno.ENOTEMPTY
assert not children, 'Directory is not empty'
shelf = self.db.delete_shelf(shelf)
# handle link counts. put after the delete call, so that if
# the delete fails, the link counts remain consistent
parent_shelf = self._path2shelf(self._path2list(
cmdict['path'])[:-1]) # fingers crossed
parent_shelf.link_count -= 1
parent_shelf.matchfields = ('link_count', )
self.db.modify_shelf(parent_shelf, commit=True)
return shelf
评论列表
文章目录