Use indent of 4 to ensure json file readability

This commit is contained in:
ItsDrike 2021-05-17 16:13:38 +02:00
parent 572c405efb
commit e250df05de
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

View file

@ -73,7 +73,7 @@ def _get_checksum_dict(file):
os.makedirs(os.path.dirname(file), exist_ok=True) os.makedirs(os.path.dirname(file), exist_ok=True)
checksums = {} checksums = {}
with open(file, 'w') as f: with open(file, 'w') as f:
json.dump(checksums, f) json.dump(checksums, f, indent=4)
return checksums return checksums
except PermissionError: except PermissionError:
print( print(
@ -99,7 +99,7 @@ def _add_file(file_path, checksum, checksum_file, update_only=False):
checksums[file_path] = checksum checksums[file_path] = checksum
try: try:
with open(checksum_file, 'w') as f: with open(checksum_file, 'w') as f:
json.dump(checksums, f) json.dump(checksums, f, indent=4)
except PermissionError: except PermissionError:
print( print(
f'{colorama.Fore.RED}PermissionError: {colorama.Fore.RESET}' f'{colorama.Fore.RED}PermissionError: {colorama.Fore.RESET}'