godesktop-applicationbinaryfilesembedded-resourcefyne

golang embed how to add a folder with pictures?


I have a code in which I directly specify the path to the folder via EMBED, but I know that you can somehow point to the folder and then just write the file name, but I don't know how to do it enter image description here

template.ParseFS(resources.Content, "*png, *jpg")


Solution

  • As you are using Fyne resources you can generate them directly from the filesystem and avoid the boilerplate by using

    fyne bundle -o planetResources.go resources/img/planets/