Skip to content

Commit

Permalink
Don't clear the dirty flag on save.
Browse files Browse the repository at this point in the history
  • Loading branch information
thane98 committed Dec 29, 2019
1 parent e18d385 commit 2f20239
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions application/services/open_files_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _save_open_files(self):
for (path, open_file) in self.open_files.items():
if open_file.dirty:
logging.info("Saving " + path + " to filesystem.")
self._try_save_archive(open_file, open_file.file, path)
self._try_save_archive(open_file.file, path)
else:
logging.info("Skipping " + path + " because it is not dirty.")

Expand All @@ -87,17 +87,16 @@ def _save_open_message_archive(self):
if message_archive.dirty:
logging.info("Saving " + path + " to filesystem.")
archive = message_archive.to_bin()
self._try_save_archive(message_archive, archive, path, True)
self._try_save_archive(archive, path, True)
else:
logging.info("Skipping " + path + " because it is not dirty.")

def _try_save_archive(self, source, archive, path, localized=False):
def _try_save_archive(self, archive, path, localized=False):
try:
if localized:
self.filesystem.write_localized_bin("/" + path, archive)
else:
self.filesystem.write_bin("/" + path, archive)
source.dirty = False
except:
logging.exception("Failed to save file " + path)

Expand Down

0 comments on commit 2f20239

Please sign in to comment.