config.go 856 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. ******************************************************************************
  3. * @file config.go
  4. * @author MakerYang
  5. ******************************************************************************
  6. */
  7. package Config
  8. import (
  9. "embed"
  10. "encoding/json"
  11. "golang.org/x/sync/errgroup"
  12. )
  13. var Get = &Data{}
  14. type Data struct {
  15. Info struct {
  16. CompanyName string `json:"companyName"`
  17. ProductName string `json:"productName"`
  18. ProductVersion string `json:"productVersion"`
  19. } `json:"info"`
  20. Group errgroup.Group
  21. }
  22. func Init(version embed.FS) {
  23. wails, _ := version.ReadFile("wails.json")
  24. var wailsJson Data
  25. err := json.Unmarshal(wails, &wailsJson)
  26. if err != nil {
  27. return
  28. }
  29. Get.Info.ProductVersion = wailsJson.Info.ProductVersion
  30. Get.Info.ProductName = wailsJson.Info.ProductName
  31. Get.Info.CompanyName = wailsJson.Info.CompanyName
  32. }