🗃️ Resource cleanup

This commit is contained in:
Nikolaj Danger
2020-08-03 15:11:24 +02:00
parent cd1eff01a0
commit 6ca2c80432
11 changed files with 42 additions and 49 deletions

View File

@@ -138,11 +138,11 @@ def findWikiPage(search : str):
def makeFiles():
# Creates swcharacters.json if it doesn't exist
try:
f = open("resources/swcharacters.json","r")
f = open("resources/starWars/swcharacters.json","r")
except:
logThis("swcharacters.json didn't exist. Making it now.")
emptyDict = {}
with open("resources/swcharacters.json","w") as f:
with open("resources/starWars/swcharacters.json","w") as f:
json.dump(emptyDict,f,indent = 4)
finally:
f.close()
@@ -160,34 +160,34 @@ def makeFiles():
# Creates monsters.json if it doesn't exist
try:
f = open("resources/monsters.json","r")
f = open("resources/lookup/monsters.json","r")
except:
logThis("monsters.json didn't exist. Making it now.")
with open("resources/lookupExamples.json") as f:
with open("resources/lookup/lookupExamples.json") as f:
data = json.load(f)["monster"]
with open("resources/monsters.json","w") as f:
with open("resources/lookup/monsters.json","w") as f:
json.dump(data,f,indent = 4)
finally:
f.close()
# Creates spells.json if it doesn't exist
try:
f = open("resources/spells.json","r")
f = open("resources/lookup/spells.json","r")
except:
logThis("spells.json didn't exist. Making it now.")
with open("resources/lookupExamples.json") as f:
with open("resources/lookup/lookupExamples.json") as f:
data = json.load(f)["spell"]
with open("resources/spells.json","w") as f:
with open("resources/lookup/spells.json","w") as f:
json.dump(data,f,indent = 4)
finally:
f.close()
# Creates destinyPoints.txt if it doesn't exist
try:
f = open("resources/destinyPoints.txt","r")
f = open("resources/starWars/destinyPoints.txt","r")
except:
logThis("destinyPoints.txt didn't exist. Making it now.")
with open("resources/destinyPoints.txt","w") as f:
with open("resources/starWars/destinyPoints.txt","w") as f:
f.write("")
finally:
f.close()