Hello, I am working on a GTK app build for MacOS, that while it initialises some things on start up , shows a splash screen. For that splash screen I have used a png file, that I just moved into the project folder and referenced it so far without any “file-structure”…
img := gtk.NewImageFromFile("Morti.png")
This works fine with go run Morti.go and go build Morti.go - ./Morti,
but when i create the app with:
mkdir -p Morti.app/Contents/MacOS
go build -o Morti.app/Contents/Morti
The png is not located and does not show. How can i solve this ?
Well, as soon as you build and distribute the application in a way, that you do not need to qualify the binary path anymore (eg. beeing able to start it using foo rather than ./foo), then your current approach wont work anymore.
Now I understand your concern. But like I said, it is a MacOS “app” not a single binary. The app is distributed in a packed dmg file. On installation it gets copied to the users application folder and is launched via double click only. Any MacOS app is basically just a link to the binary and a hidden folder “contents” with the binary and resources like icons etc. In my case it consists apart from the binary and icon also of a splash screen image.
Okay… Basically naming the packages d(a)m(a)g(e) tells me everything I need to know about Mac OS
Feels a weird way if distribution, but if that’s the way to go, then that’s the way to go… Even Microsoft started to discourage relying on the fact that you can infer the data dir from the binaries place in the filesystem…