| 70 | self._update(flag) |
| 71 | |
| 72 | def _create(self, flag): |
| 73 | if flag == 'n': |
| 74 | for filename in (self._datfile, self._bakfile, self._dirfile): |
| 75 | try: |
| 76 | _os.remove(filename) |
| 77 | except OSError: |
| 78 | pass |
| 79 | # Mod by Jack: create data file if needed |
| 80 | try: |
| 81 | f = _io.open(self._datfile, 'r', encoding="Latin-1") |
| 82 | except OSError: |
| 83 | if flag not in ('c', 'n'): |
| 84 | raise |
| 85 | with _io.open(self._datfile, 'w', encoding="Latin-1") as f: |
| 86 | self._chmod(self._datfile) |
| 87 | else: |
| 88 | f.close() |
| 89 | |
| 90 | # Read directory file into the in-memory index dict. |
| 91 | def _update(self, flag): |