0.3.11 Trying to write xml data. /JL

This commit is contained in:
2022-12-22 23:28:11 +01:00
parent 9d7c215ea9
commit a0d9fed4da
3 changed files with 32 additions and 5 deletions
+10 -1
View File
@@ -3,6 +3,7 @@ package main
import (
"encoding/xml"
"io"
"io/ioutil"
"log"
"os"
@@ -56,7 +57,7 @@ type (
XMLName xml.Name `xml:"serie"`
Name string `xml:"name,attr"`
InStock bool `xml:"inStock"`
OnHand int `xml:"onHand"`
OnHand string `xml:"onHand"`
}
Pegboards struct {
@@ -225,3 +226,11 @@ func CheckPalletteFile() bool {
}
return true
}
func WritePaletteFile(mw *MyMainWindow) {
file, err := xml.MarshalIndent(mw.pallette, "", " ")
if err != nil {
log.Printf("Failed to marshal: %v", err)
}
_ = ioutil.WriteFile(UserPath+Sep+"pallette.xml", file, 0644)
}