mirror of
https://github.com/sbrow/ps.git
synced 2025-12-29 18:47:38 -05:00
Fixed doc.Dump to not dump fullName, as this is system specific information.
This commit is contained in:
12
document.go
12
document.go
@@ -35,7 +35,7 @@ type DocumentJSON struct {
|
|||||||
|
|
||||||
// MarshalJSON returns the Document in JSON format.
|
// MarshalJSON returns the Document in JSON format.
|
||||||
func (d *Document) MarshalJSON() ([]byte, error) {
|
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})
|
Width: d.width, ArtLayers: d.artLayers, LayerSets: d.layerSets})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,6 @@ func (d *Document) LayerSet(name string) *LayerSet {
|
|||||||
func ActiveDocument() (*Document, error) {
|
func ActiveDocument() (*Document, error) {
|
||||||
log.Println("Loading ActiveDocument")
|
log.Println("Loading ActiveDocument")
|
||||||
d := &Document{}
|
d := &Document{}
|
||||||
|
|
||||||
byt, err := DoJS("activeDocFullName.jsx")
|
byt, err := DoJS("activeDocFullName.jsx")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -181,6 +180,13 @@ func (d *Document) Restore(path string) error {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
log.Println("Previous version found, loading")
|
log.Println("Previous version found, loading")
|
||||||
err = json.Unmarshal(byt, &d)
|
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
|
return err
|
||||||
}
|
}
|
||||||
@@ -213,7 +219,7 @@ func (d *Document) DumpFile() string {
|
|||||||
// Dump saves the document to disk in JSON format.
|
// Dump saves the document to disk in JSON format.
|
||||||
func (d *Document) Dump() {
|
func (d *Document) Dump() {
|
||||||
log.Println("Dumping to disk")
|
log.Println("Dumping to disk")
|
||||||
log.Println(d.DumpFile(), d.FullName())
|
log.Println(d.DumpFile())
|
||||||
defer d.Save()
|
defer d.Save()
|
||||||
f, err := os.Create(d.DumpFile())
|
f, err := os.Create(d.DumpFile())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user