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