Store configuration in user configuration directory
This commit is contained in:
@ -136,13 +136,14 @@ class Game:
|
||||
"""
|
||||
Loads the game from a file
|
||||
"""
|
||||
if os.path.isfile("save.json"):
|
||||
with open("save.json", "r") as f:
|
||||
file_path = ResourceManager.get_config_path("save.json")
|
||||
if os.path.isfile(file_path):
|
||||
with open(file_path, "r") as f:
|
||||
self.load_state(json.loads(f.read()))
|
||||
|
||||
def save_game(self) -> None:
|
||||
"""
|
||||
Saves the game to a file
|
||||
"""
|
||||
with open("save.json", "w") as f:
|
||||
with open(ResourceManager.get_config_path("save.json"), "w") as f:
|
||||
f.write(json.dumps(self.save_state()))
|
||||
|
Reference in New Issue
Block a user