From f05c4e4b32d4a91527f33c8082bd597859f37664 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Wed, 19 Jul 2023 08:57:00 +0100 Subject: [PATCH] Don't write out 'LinuxAndBSD' section on every package Make it optional instead :) --- cmd/fyne/internal/commands/package-unix.go | 15 ++++++++++----- cmd/fyne/internal/commands/package.go | 2 +- cmd/fyne/internal/metadata/data.go | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/fyne/internal/commands/package-unix.go b/cmd/fyne/internal/commands/package-unix.go index 02c1584904..e7384b909d 100644 --- a/cmd/fyne/internal/commands/package-unix.go +++ b/cmd/fyne/internal/commands/package-unix.go @@ -7,6 +7,7 @@ import ( "path/filepath" "strings" + "fyne.io/fyne/v2/cmd/fyne/internal/metadata" "fyne.io/fyne/v2/cmd/fyne/internal/templates" "golang.org/x/sys/execabs" @@ -58,16 +59,20 @@ func (p *Packager) packageUNIX() error { desktop := filepath.Join(appsDir, p.Name+".desktop") deskFile, _ := os.Create(desktop) + linuxBSD := metadata.LinuxAndBSD{} + if p.linuxAndBSDMetadata != nil { + linuxBSD = *p.linuxAndBSDMetadata + } tplData := unixData{ Name: p.Name, Exec: filepath.Base(p.exe), Icon: p.Name + filepath.Ext(p.icon), Local: local, - GenericName: p.linuxAndBSDMetadata.GenericName, - Keywords: formatDesktopFileList(p.linuxAndBSDMetadata.Keywords), - Comment: p.linuxAndBSDMetadata.Comment, - Categories: formatDesktopFileList(p.linuxAndBSDMetadata.Categories), - ExecParams: p.linuxAndBSDMetadata.ExecParams, + GenericName: linuxBSD.GenericName, + Keywords: formatDesktopFileList(linuxBSD.Keywords), + Comment: linuxBSD.Comment, + Categories: formatDesktopFileList(linuxBSD.Categories), + ExecParams: linuxBSD.ExecParams, } err = templates.DesktopFileUNIX.Execute(deskFile, tplData) if err != nil { diff --git a/cmd/fyne/internal/commands/package.go b/cmd/fyne/internal/commands/package.go index 93b801799a..06e3d86d8e 100644 --- a/cmd/fyne/internal/commands/package.go +++ b/cmd/fyne/internal/commands/package.go @@ -136,7 +136,7 @@ type Packager struct { tempDir string customMetadata keyValueFlag - linuxAndBSDMetadata metadata.LinuxAndBSD + linuxAndBSDMetadata *metadata.LinuxAndBSD } // AddFlags adds the flags for interacting with the package command. diff --git a/cmd/fyne/internal/metadata/data.go b/cmd/fyne/internal/metadata/data.go index e4d0918a53..6517c025f0 100644 --- a/cmd/fyne/internal/metadata/data.go +++ b/cmd/fyne/internal/metadata/data.go @@ -6,7 +6,7 @@ type FyneApp struct { Details AppDetails Development map[string]string `toml:",omitempty"` Release map[string]string `toml:",omitempty"` - LinuxAndBSD LinuxAndBSD + LinuxAndBSD *LinuxAndBSD `toml:",omitempty"` } // AppDetails describes the build information, this group may be OS or arch specific