def setdata(self):
"""Refresh stat cache"""
try:
# We may be asked to look at the target of symlinks rather than
# the link itself.
if globals.copy_links:
self.stat = os.stat(self.name)
else:
self.stat = os.lstat(self.name)
except OSError as e:
err_string = errno.errorcode[e[0]]
if err_string in ["ENOENT", "ENOTDIR", "ELOOP", "ENOTCONN"]:
self.stat, self.type = None, None # file doesn't exist
self.mode = None
else:
raise
else:
self.set_from_stat()
if self.issym():
self.symtext = os.readlink(self.name)
评论列表
文章目录