I’m writing a GNOME application using gtk-rs. Right now I’m using pure cargo to build, as in the tutorial Introduction - GUI development with Rust and GTK 4 , so no Flatpak, meson, … but I want to get into this stuff later. I am saving user data in an sqlite database. Right now, I have hardcoded the location of the database on my computer in the Rust source code.
However I know that the location should depend on the way the app is going to be installed, so it should be in .var/app/… if it’s installed via flatpak, or maybe in .local/share/… otherwise. What is the proper way to define a path that will work on all systems?
Also I wonder: Should the initial creation of the database be done when running my app for the first time, or should this be part of the installation process?