I’ve started to experiment with snaps yesterday for the first time, because putting my app to the snap store might be a good way to reach new users.
After a few hours, I managed to create a snap that installs fine and includes all the assets and libraries. (I had to use “environment:” to adjust the $PATH variable so the app can access the pulseaudio library, though).
Note that I just DUMP all app files into the snap, no compiling etc. needed. Usually my app is self contained, i.e. in the main folder, there is the binary and in subfolders are various assets. Also, config and save files (it’s a game) are saved in in the app folder, so currently end users simply download a zip, extract it and run the binary, and everything is fine. If they don’t like it anymore, they just delete the folder and no remains are left.
Obviously, this simple approach is not possible when I want to use snaps, because my app can’t write in the app’s folder, so I can’t save config and save files.
- What is the best place for storing app specific config files? I’d say the user’s home directory, but can my app write to it?
Another question is asset file access. When one downloads the (non-snap) zip of my game and runs the binary by double clicking it, all assets are found. But when I install my test snap of my app, assets are only found if I first cd into the app’s folder.
- Should I create a shell script that first changes to the snap’s folder and the executes the binary? Or should my binary itself, during runtime, get its own location and then cd into this location before it loads any assets?