diff --git a/core/core.go b/core/core.go index 70f9cb7..1f92d76 100644 --- a/core/core.go +++ b/core/core.go @@ -62,3 +62,18 @@ func Init(dataPath string) error { } return nil } + +func (d *FullData) WriteJSON(dataPath string) error { + d.Lock() + jsonBytes, err := json.MarshalIndent(&d, "", "\t") + d.Unlock() + if err != nil { + return err + } + err = ioutil.WriteFile(filepath.Join(dataPath, "comitium.json"), jsonBytes, 0666) + if err != nil { + return err + } + + return nil +}