英文:
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
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/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论