fix settings implementation

This commit is contained in:
Vadim Lopatin 2015-02-17 17:40:44 +03:00
parent 54bb53d4e5
commit f4fad909c2
1 changed files with 14 additions and 1 deletions

View File

@ -104,6 +104,7 @@ class SettingsFile {
bool res = _setting.load(_filename);
if (res)
_loaded = true;
afterLoad();
return res;
}
return false;
@ -127,9 +128,21 @@ class SettingsFile {
}
bool res = _setting.save(_filename, pretty);
res = updateModificationTime() || res;
afterSave();
return res;
}
/// override to add default values if missing
void updateDefaults() {
}
/// override to do something after loading - e.g. set defaults
void afterLoad() {
}
/// override to do something after saving
void afterSave() {
}
}
/// setting object
@ -1016,7 +1029,7 @@ final class Setting {
return null;
s = new Setting();
s.clear(SettingType.OBJECT);
this[part1] = s;
this[path] = s;
}
return s;
}