My new AppImage-contained Qt application needs some writable configuration files and data files. These files should be user specific. I intend to located them in ~/.appname.
It would be easy to initially create empty files in ~/.appname using the application. However I would like to provide non-empty default files when delivering the AppImage.
When using a conventional executable installer I would integrate the default files into the installer and copy them to the appropriate places during installation. But installers do not make sense when using AppImages.
I could integrate the default files in the AppImage and execute the initial file copy operation by means of my application. However I would consider this a bad workaround since I think that this copy operation is part of the deployment and not part of the application.
So what is the intended way of setting up the default user configuration when using an AppImage?
These solutions have the advantage that they will work on all platforms, not just linux. For my application I create the default settings file if it does not already exist, which effectively creates it the first time the application is run. To me this is preferable to expecting the installer to put default files into fixed locations, especially since AppImages are not installed as you noted.
QSettings is a good solution for all the config stuff. However I planned to deploy one type of user modifiable data file that can not be covered that way.
There is no way of detecting the very first run of an AppImage and executing some deployment script?
Then the only way would be to integrate the code in the application. The latter is a bit of nasty but at least it will be portable due to the nature of Qt.
An AppImage is just a self-mounting filesystem image that executes whatever you put inside it. So the logic to initialize settings files within $HOME falls into the realm of the application logic. The application should, upon launch, check whether all the required config files are there and if not, create/copy them in place.