| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Utilities for PyAuto.""" | 7 """Utilities for PyAuto.""" |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 def _CleanupRequestedPath(self): | 70 def _CleanupRequestedPath(self): |
| 71 if os.path.exists(self._path): | 71 if os.path.exists(self._path): |
| 72 if os.path.isdir(self._path): | 72 if os.path.isdir(self._path): |
| 73 shutil.rmtree(self._path, ignore_errors=True) | 73 shutil.rmtree(self._path, ignore_errors=True) |
| 74 else: | 74 else: |
| 75 os.remove(self._path) | 75 os.remove(self._path) |
| 76 | 76 |
| 77 def _RemoveBackupDir(self): | 77 def _RemoveBackupDir(self): |
| 78 if self._backup_dir and os.path.isdir(self._backup_dir): | 78 if self._backup_dir and os.path.isdir(self._backup_dir): |
| 79 shutil.rmtree(self._backup_dir, ignore_errors=True) | 79 shutil.rmtree(self._backup_dir, ignore_errors=True) |
| 80 |
| 81 |
| 82 def RemovePath(path): |
| 83 """Remove the given path (file or dir).""" |
| 84 if os.path.isdir(path): |
| 85 shutil.rmtree(path, ignore_errors=True) |
| 86 return |
| 87 os.remove(path) |
| 88 |
| OLD | NEW |