def _del_path(self, path):
common.addon.log('Attempting to remove folder: %s' % path, 0)
if xbmcvfs.exists(path):
try:
common.addon.log('Removing folder: %s' % path, 0)
try:
dirs, files = xbmcvfs.listdir(path)
for file in files:
xbmcvfs.delete(os.path.join(path, file))
success = xbmcvfs.rmdir(path)
if success == 0:
raise
except Exception, e:
try:
common.addon.log('Failed to delete path using xbmcvfs: %s' % e, 4)
common.addon.log('Attempting to remove with shutil: %s' % path, 0)
shutil.rmtree(path)
except:
raise
except Exception, e:
common.addon.log('Failed to delete path: %s' % e, 4)
return False
else:
common.addon.log('Folder does not exist: %s' % path)
评论列表
文章目录