golang embed how to add a folder with pictures?

huangapple go评论75阅读模式
英文:

golang embed how to add a folder with pictures?

问题

我有一段代码,在其中直接通过EMBED指定文件夹的路径,但我知道可以以某种方式指向文件夹,然后只需写入文件名,但我不知道如何做到这一点。

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

英文:

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
golang embed how to add a folder with pictures?

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

答案1

得分: 1

由于您正在使用Fyne资源,您可以直接从文件系统中生成它们,并通过使用以下命令避免繁琐的操作:

fyne bundle -o planetResources.go resources/img/planets/
英文:

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/

huangapple
  • 本文由 发表于 2023年3月6日 05:07:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75645356.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定