From f1b778a05b9ce3fa338e775944be5245884185be Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 3 Sep 2018 14:18:16 -0400 Subject: [PATCH] Fixed doc.Dump to not dump fullName, as this is system specific information. --- document.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/document.go b/document.go index f8ade67..5347727 100644 --- a/document.go +++ b/document.go @@ -35,7 +35,7 @@ type DocumentJSON struct { // MarshalJSON returns the Document in JSON format. func (d *Document) MarshalJSON() ([]byte, error) { - return json.Marshal(&DocumentJSON{Name: d.name, FullName: d.fullName, Height: d.height, + return json.Marshal(&DocumentJSON{Name: d.name, Height: d.height, Width: d.width, ArtLayers: d.artLayers, LayerSets: d.layerSets}) } @@ -130,7 +130,6 @@ func (d *Document) LayerSet(name string) *LayerSet { func ActiveDocument() (*Document, error) { log.Println("Loading ActiveDocument") d := &Document{} - byt, err := DoJS("activeDocFullName.jsx") if err != nil { return nil, err @@ -181,6 +180,13 @@ func (d *Document) Restore(path string) error { if err == nil { log.Println("Previous version found, loading") err = json.Unmarshal(byt, &d) + if err == nil { + byt, err := DoJS("activeDocFullName.jsx") + if err != nil { + return nil, err + } + d.fullName = strings.TrimRight(string(byt), "\r\n") + } } return err } @@ -213,7 +219,7 @@ func (d *Document) DumpFile() string { // Dump saves the document to disk in JSON format. func (d *Document) Dump() { log.Println("Dumping to disk") - log.Println(d.DumpFile(), d.FullName()) + log.Println(d.DumpFile()) defer d.Save() f, err := os.Create(d.DumpFile()) if err != nil {