evdist: New project to handle settings programming
This commit is contained in:
parent
0831ea6088
commit
af6e86d4ef
9 changed files with 384 additions and 11 deletions
|
@ -3,7 +3,6 @@ package settings
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
|
@ -67,6 +66,9 @@ func ListNextSettingsFiles() ([]*NextSettingsFile, error) {
|
|||
|
||||
var ret []*NextSettingsFile
|
||||
for _, file := range files {
|
||||
if len(file.Name()) < 10 {
|
||||
continue
|
||||
}
|
||||
ts, err := strconv.ParseInt(file.Name()[:10], 10, 64)
|
||||
if err == nil {
|
||||
nsf, err := ReadNextSettingsFile(path.Join(SettingsDir, file.Name()), ts)
|
||||
|
@ -108,7 +110,6 @@ func MergeSettings(current Settings, new map[string]interface{}) *Settings {
|
|||
}
|
||||
|
||||
if v, ok := new[name]; ok {
|
||||
log.Println(name, field.Name, v)
|
||||
reflect.ValueOf(¤t).Elem().FieldByName(field.Name).Set(reflect.ValueOf(v))
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue