##// END OF EJS Templates
vfs: have tryunlink tell what it did...
Georges Racinet -
r52323:187c5769 default
parent child Browse files
Show More
@@ -2610,12 +2610,16 b' def unlinkpath('
2610 pass
2610 pass
2611
2611
2612
2612
2613 def tryunlink(f: bytes) -> None:
2613 def tryunlink(f: bytes) -> bool:
2614 """Attempt to remove a file, ignoring FileNotFoundError."""
2614 """Attempt to remove a file, ignoring FileNotFoundError.
2615
2616 Returns False in case the file did not exit, True otherwise
2617 """
2615 try:
2618 try:
2616 unlink(f)
2619 unlink(f)
2620 return True
2617 except FileNotFoundError:
2621 except FileNotFoundError:
2618 pass
2622 return False
2619
2623
2620
2624
2621 def makedirs(
2625 def makedirs(
@@ -303,7 +303,7 b' class abstractvfs:'
303
303
304 def tryunlink(self, path: Optional[bytes] = None):
304 def tryunlink(self, path: Optional[bytes] = None):
305 """Attempt to remove a file, ignoring missing file errors."""
305 """Attempt to remove a file, ignoring missing file errors."""
306 util.tryunlink(self.join(path))
306 return util.tryunlink(self.join(path))
307
307
308 def unlinkpath(
308 def unlinkpath(
309 self, path: Optional[bytes] = None, ignoremissing=False, rmdir=True
309 self, path: Optional[bytes] = None, ignoremissing=False, rmdir=True
General Comments 0
You need to be logged in to leave comments. Login now