mirror of
https://github.com/myned/modufur.git
synced 2024-12-23 22:27:27 +00:00
Merge branch 'dev'
This commit is contained in:
commit
c488b84df2
1 changed files with 5 additions and 5 deletions
|
@ -41,15 +41,15 @@ def setdefault(filename, default=None, json=False):
|
|||
if json:
|
||||
try:
|
||||
with open(filename, 'rb') as infile:
|
||||
print(f'LOADED : {filename}')
|
||||
return jsn.load(infile)
|
||||
print(f'LOADED : {filename}')
|
||||
return jsn.load(infile)
|
||||
|
||||
except FileNotFoundError:
|
||||
with open(filename, 'wb+') as iofile:
|
||||
print(f'FILE NOT FOUND : {filename} created and loaded with default values')
|
||||
jsn.dump(default, iofile)
|
||||
print(f'FILE NOT FOUND : {filename} created and loaded with default values')
|
||||
jsn.dump(default, iofile)
|
||||
iofile.seek(0)
|
||||
return jsn.load(iofile)
|
||||
return jsn.load(iofile)
|
||||
else:
|
||||
try:
|
||||
with open(filename, 'rb') as infile:
|
||||
|
|
Loading…
Reference in a new issue