Changed how load_config works so it always supports new config vars

This commit is contained in:
bkkcoins 2012-09-21 04:48:03 +07:00
parent 9121654e8a
commit 8244768654
1 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,9 @@ class SimpleConfig:
f = open(self.config_file_path(), "r")
file_contents = f.read()
if file_contents:
self.config = json.loads(file_contents)
user_config = json.loads(file_contents)
for i in user_config:
self.config[i] = user_config[i]
else:
self.config = self.default_options
self.save_config()
@ -29,10 +31,9 @@ class SimpleConfig:
def __init__(self):
# Find electrum data folder
self.config_folder = user_dir()
self.config = self.default_options
# Read the file
if os.path.exists(self.config_file_path()):
self.load_config()
else:
self.config = self.default_options
self.save_config()
self.save_config()