Skip to content

Commit

Permalink
Revert "Pull in pr xtream1101#45's changes to use temp files to preve…
Browse files Browse the repository at this point in the history
…nt corruption"

This reverts commit 259dbde.
  • Loading branch information
SonarBeserk committed Nov 3, 2022
1 parent 2450c76 commit 4b1ae5f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions humblebundle_downloader/download_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def __init__(self, library_path, cookie_path=None, cookie_auth=None,
def start(self):

self.cache_file = os.path.join(self.library_path, '.cache.json')
self.cache_file_temp = os.path.join(self.library_path, '.tmp.cache.json')
self.cache_data = self._load_cache_data(self.cache_file)
self.purchase_keys = self.purchase_keys if self.purchase_keys else self._get_purchase_keys() # noqa: E501

Expand Down Expand Up @@ -311,14 +310,11 @@ def _update_cache_data(self, cache_file_key, file_info):
# quits it can keep track of the progress
# Note: Only safe because of single thread,
# need to change if refactor to multi threading
with open(self.cache_file_temp, 'w') as outfile:
with open(self.cache_file, 'w') as outfile:
json.dump(
self.cache_data, outfile,
sort_keys=True, indent=4,
)

outfile.close() #explicitly close outfile and flush output buffer.
os.rename(self.cache_file_temp,self.cache_file) #rename temp file to real file.

def _process_download(self, open_r, cache_file_key, file_info,
local_filename, rename_str=None):
Expand Down

0 comments on commit 4b1ae5f

Please sign in to comment.