Search code examples
windowsgodesktop-applicationdesktopfyne

how to compile a project on fyne and golang with images?


I have a project where I upload images with the function: "file.Load Resource From Path("resources/img/planets/mercury.png")", but when I try to compile the project with the command: "fyne-cross windows -arch=*" and transfer the EXE FILE where from the current directory, the pictures in my program are not displayed

go build main.go, fyne-cross windows -arch=386 I don't know what I can doing enter image description here enter image description here enter image description here


Solution

  • The “resources” folder is just part of your source code. Fyne (like Go) apps are single binaries and not distributed with assets. If you want to include items like that you should bundle them - “fyne bundle” or “go embed” will sort this for you.