Show More
@@ -292,7 +292,7 b' def pathto(root, n1, n2):' | |||
|
292 | 292 | b.reverse() |
|
293 | 293 | return os.sep.join((['..'] * len(a)) + b) or '.' |
|
294 | 294 | |
|
295 |
def canonpath(root, cwd, myname, audit |
|
|
295 | def canonpath(root, cwd, myname, auditor=None): | |
|
296 | 296 | """return the canonical path of myname, given cwd and root""" |
|
297 | 297 | if endswithsep(root): |
|
298 | 298 | rootsep = root |
@@ -302,11 +302,11 b' def canonpath(root, cwd, myname, audit_p' | |||
|
302 | 302 | if not os.path.isabs(name): |
|
303 | 303 | name = os.path.join(root, cwd, name) |
|
304 | 304 | name = os.path.normpath(name) |
|
305 |
if audit |
|
|
306 |
audit |
|
|
305 | if auditor is None: | |
|
306 | auditor = path_auditor(root) | |
|
307 | 307 | if name != rootsep and name.startswith(rootsep): |
|
308 | 308 | name = name[len(rootsep):] |
|
309 |
audit |
|
|
309 | auditor(name) | |
|
310 | 310 | return pconvert(name) |
|
311 | 311 | elif name == root: |
|
312 | 312 | return '' |
@@ -330,7 +330,7 b' def canonpath(root, cwd, myname, audit_p' | |||
|
330 | 330 | return '' |
|
331 | 331 | rel.reverse() |
|
332 | 332 | name = os.path.join(*rel) |
|
333 |
audit |
|
|
333 | auditor(name) | |
|
334 | 334 | return pconvert(name) |
|
335 | 335 | dirname, basename = os.path.split(name) |
|
336 | 336 | rel.append(basename) |
@@ -836,9 +836,9 b' class opener(object):' | |||
|
836 | 836 | def __init__(self, base, audit=True): |
|
837 | 837 | self.base = base |
|
838 | 838 | if audit: |
|
839 |
self.audit |
|
|
839 | self.auditor = path_auditor(base) | |
|
840 | 840 | else: |
|
841 |
self.audit |
|
|
841 | self.auditor = always | |
|
842 | 842 | self.createmode = None |
|
843 | 843 | |
|
844 | 844 | @propertycache |
@@ -851,7 +851,7 b' class opener(object):' | |||
|
851 | 851 | os.chmod(name, self.createmode & 0666) |
|
852 | 852 | |
|
853 | 853 | def __call__(self, path, mode="r", text=False, atomictemp=False): |
|
854 |
self.audit |
|
|
854 | self.auditor(path) | |
|
855 | 855 | f = os.path.join(self.base, path) |
|
856 | 856 | |
|
857 | 857 | if not text and "b" not in mode: |
@@ -876,7 +876,7 b' class opener(object):' | |||
|
876 | 876 | return fp |
|
877 | 877 | |
|
878 | 878 | def symlink(self, src, dst): |
|
879 |
self.audit |
|
|
879 | self.auditor(dst) | |
|
880 | 880 | linkname = os.path.join(self.base, dst) |
|
881 | 881 | try: |
|
882 | 882 | os.unlink(linkname) |
General Comments 0
You need to be logged in to leave comments.
Login now