Skip to content

Commit

Permalink
Fixed: Preferences were being overwritten every time you ran the app
Browse files Browse the repository at this point in the history
  • Loading branch information
Patitotective committed Apr 14, 2022
1 parent 6e7d86b commit 7dcc81b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ proc initconfig*(app: var App, settings: PrefsNode) =
# Add the preferences with the values defined in config["settings"]
for name, data in settings:
let settingType = parseEnum[SettingTypes](data["type"])
if settingType != Section:
app.prefs[name] = data["default"]
else:
app.initConfig(data["content"])
if settingType == Section:
app.initConfig(data["content"])
elif name notin app.prefs:
app.prefs[name] = data["default"]

proc initApp*(config: PObjectType): App =
result = App(config: config, somefloat: 0.5f, counter: 2)
Expand Down

0 comments on commit 7dcc81b

Please sign in to comment.