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