analyzesize: create db on first use

This commit is contained in:
Philippe Teuwen 2019-07-18 23:42:58 +02:00
parent ed85df110e
commit 41731ea084

View file

@ -10,7 +10,10 @@ def print_increase(x, y, name):
else:
print("{} decrease by: {} (0x{:08X}) bytes ({}%)".format(name, y-x, y-x, (y-x)*100/x))
dbname = "tools/data.json"
db = json.load(open(dbname,"r"))
try:
db = json.load(open(dbname,"r"))
except FileNotFoundError:
db = dict()
if len(sys.argv) < 3:
print("Usage: analazysize.py <info|add|diff> <datasetname>")