本文整理汇总了Python中bleachbit.FileUtilities.ego_owner方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtilities.ego_owner方法的具体用法?Python FileUtilities.ego_owner怎么用?Python FileUtilities.ego_owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bleachbit.FileUtilities
的用法示例。
在下文中一共展示了FileUtilities.ego_owner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_commands
# 需要导入模块: from bleachbit import FileUtilities [as 别名]
# 或者: from bleachbit.FileUtilities import ego_owner [as 别名]
#.........这里部分代码省略.........
# (or at least truncated).
#
# GNOME 2.28.1 (Ubuntu 9.10) and 2.30 (10.04) do not re-read
# the file after truncation, but do re-read it after
# shredding.
#
# https://bugzilla.gnome.org/show_bug.cgi?id=591404
def gtk_purge_items():
"""Purge GTK items"""
gtk.RecentManager().purge_items()
yield 0
for pathname in ["~/.recently-used.xbel", "~/.local/share/recently-used.xbel"]:
pathname = expanduser(pathname)
if os.path.lexists(pathname):
yield Command.Shred(pathname)
if HAVE_GTK:
# Use the Function to skip when in preview mode
yield Command.Function(None, gtk_purge_items, _('Recent documents list'))
if 'posix' == os.name and 'rotated_logs' == option_id:
for path in Unix.rotated_logs():
yield Command.Delete(path)
# temporary files
if 'posix' == os.name and 'tmp' == option_id:
dirnames = ['/tmp', '/var/tmp']
for dirname in dirnames:
for path in children_in_directory(dirname, True):
is_open = FileUtilities.openfiles.is_open(path)
ok = not is_open and os.path.isfile(path) and \
not os.path.islink(path) and \
FileUtilities.ego_owner(path) and \
not self.whitelisted(path)
if ok:
yield Command.Delete(path)
# temporary files
if 'nt' == os.name and 'tmp' == option_id:
dirname1 = expandvars(
"$USERPROFILE\\Local Settings\\Temp\\")
dirname2 = expandvars(r'%temp%')
dirname3 = expandvars("%windir%\\temp\\")
dirnames = []
if Windows.get_windows_version() >= 6.0:
# Windows Vista or later
dirnames.append(dirname2)
else:
# Windows XP
dirnames.append(dirname1)
dirnames.append(dirname3)
# whitelist the folder %TEMP%\Low but not its contents
# https://bugs.launchpad.net/bleachbit/+bug/1421726
for dirname in dirnames:
low = os.path.join(dirname, 'low').lower()
for filename in children_in_directory(dirname, True):
if not low == filename.lower():
yield Command.Delete(filename)
# trash
if 'posix' == os.name and 'trash' == option_id:
dirname = expanduser("~/.Trash")
for filename in children_in_directory(dirname, False):
yield Command.Delete(filename)
# fixme http://www.ramendik.ru/docs/trashspec.html