fixed settings not creating if data folder not exists
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Settings:
|
class Settings:
|
||||||
@@ -16,8 +17,12 @@ class Settings:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fix() -> None:
|
def fix() -> None:
|
||||||
with open("data/settings.json", "w") as file:
|
try:
|
||||||
|
with open("data/settings.json", "w+") as file:
|
||||||
json.dump(Settings.default(), file)
|
json.dump(Settings.default(), file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
os.mkdir("data")
|
||||||
|
Settings.fix()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_settings() -> dict:
|
def get_settings() -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user