Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ddc committed Aug 10, 2020
1 parent 33962dc commit c1d6b0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def _update_arcdps(self):
self.qtObj.main_tabWidget.setCurrentIndex(2)
return False

current_d3d9_md5 = utilities.md5Checksum(d3d9_path)
current_d3d9_md5 = utilities.md5_checksum(d3d9_path)
if req_d3d9_md5 != current_d3d9_md5:
utilities.backup_arcdps_files(self, "backup")

Expand Down
17 changes: 11 additions & 6 deletions src/utils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,20 @@ def dialog_get_file_path():


################################################################################
def md5Checksum(filePath):
with open(filePath, 'rb') as fh:
m = hashlib.md5()
def md5_checksum(file_path):
BUF_SIZE = 8192
md5 = hashlib.md5()
# sha1 = hashlib.sha1()

with open(file_path, 'rb') as f:
while True:
data = fh.read(8192)
data = f.read(BUF_SIZE)
if not data:
break
m.update(data)
return m.hexdigest()
md5.update(data)
# sha1.update(data)
# return sha1.hexdigest()
return md5.hexdigest()


################################################################################
Expand Down

0 comments on commit c1d6b0b

Please sign in to comment.