Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion etils/epath/gpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,14 @@ def rmdir(self) -> None:

def rmtree(self, missing_ok: bool = False) -> None:
"""Remove the directory."""
path_str = self._path_str
# copybara: strip_begin
# gfile.DeleteRecursively doesn't work when there's a trailing slash.
# copybara: strip_end
if path_str.endswith('/'):
path_str = path_str[:-1]
try:
self._backend.rmtree(self._path_str)
self._backend.rmtree(path_str)
except FileNotFoundError:
if not missing_ok:
raise
Expand Down