From 5cb7b021025d1057b89836303f40256a087aee3c Mon Sep 17 00:00:00 2001 From: AntonioCastelli Date: Fri, 10 Dec 2021 04:29:33 -0800 Subject: [PATCH] Refactored variable. (#190) From comment in https://github.com/DavidSM64/Diddy-Kong-Racing/pull/189. --- tools/python/generate_ld.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/python/generate_ld.py b/tools/python/generate_ld.py index 3591922a..af10e734 100644 --- a/tools/python/generate_ld.py +++ b/tools/python/generate_ld.py @@ -228,11 +228,12 @@ class GenerateLD: files.sort(key = lambda x: (x[2], x[3])) # Sort tuples by RAM address and prioritize src files first. return files -if not os.path.exists('./dkr.ld') and os.path.exists('./assets/' + VERSION + '/md5.txt'): - os.remove('./assets/' + VERSION + '/md5.txt') +checksum_file = './assets/' + VERSION + '/md5.txt' +if not os.path.exists('./dkr.ld') and os.path.exists(checksum_file): + os.remove(checksum_file) -if os.path.exists('./assets/' + VERSION + '/md5.txt'): - with open('./assets/' + VERSION + '/md5.txt', "rt") as a_file: +if os.path.exists(checksum_file): + with open(checksum_file, "rt") as a_file: with open('./assets/' + VERSION + '/assets.json',"rb") as f: bytes = f.read() # read file as bytes readable_hash = hashlib.md5(bytes).hexdigest();