Open chran554 opened 1 week ago
The metadata is injected into the application, to do that it needs to compile it with the appropriate options.
It is not clear why you are pre-compiling separate to the fyne package command, but if that is part of your worflow consider "fyne build" instead of "go build" as that will insert your metadata.
ok, maybe it is a matter of documentation to clearify that the parameters are of no use when using executable?
Even better, let the "package" command make the options "executable" and "sourceDir" mutually exclusive with printed error message if you try to specify both? Also print warning or error if you try to use app and metadata parameters when specifying "executable", since they can not be used/are ignored/is of no use?
We could perhaps take that approach, but it is not quite that simple. The parameters will have effect in many areas - it's just that "App.Metadata()" call which requires "fyne package" or "fyne build" to have been used in binary creation.
The metadata for the OS (except on Windows) is in the packaging format and will have effect irrespective of whether you built it outside the ecosystem.
It would probably be a simpler documentation change to just specify that "fyne package" or "fyne build" must be used to correctly package a fyne app.
Checklist
Describe the bug
When packageing my application with "fyne package" on a compiled fyne binary, I can not retrieve the metadata from within the application.
How to reproduce
go build -o metadataapp fynemetadata/main.go
fyne package --executable metadataapp --name "Metadata App" --appID="com.dummy.id" --appVersion="1.2.3" --appBuild=42 --icon star-icon.png
open Metadata\ App.app
Screenshots
Example code
File: fynemetadata/main.go
Fyne version
fyne cli version: v2.5.2
Go compiler version
go version go1.23.2 darwin/arm64
Operating system and version
Apple M1 Apple silicon, macOS Sonoma 14.6.1 (23G93)
Additional Information
Workaround: In the case you have access to the code you can specify the source directory at package time. Qualified guess is that the program will be recompiled (not using the already compiled binary) with extra generated application init file (setting up the metadata).
fyne package --src fynemetadata/ --executable metadataapp --name "Metadata App" --appID="com.dummy.id" --appVersion="1.2.3" --appBuild=42 --icon ../star-icon.png
But that still makes this issue with "fyne package" using precompiled binary valid, since it will miss the metadata in the application.