text: Adding static data files to an AppImage - Creating AppImages - AppImage
  Adding static data files to an AppImage
  Silicomancer April 21, 2018, 10:39am #1
  I successfully created my first AppImage. It contains a Qt application. Now I want to add static (read-only) xml data files into the AppImage but I don't get it work.
  What is the best place to add the files? I thought about AppDir/usr/share/appname/*.xml but I am not sure if there is a better place.
  How can I access the files from within my application? I inspected QDir::current().absolutePath() and QFileInfo(".").absolutePath() but both paths are located out of the AppImage tree.
  cgarry April 22, 2018, 7:08am #2
  Assuming I understand what you are trying to do, I would (and do in my application) use the QT resource system which will include your xml files in the application's executable.
  From within your application you then access the file using a path similar to this: ":/res/filename.xml". This has the advantage that it will work in the same way whether or not your application is packaged as an AppImage.
  Silicomancer April 22, 2018, 10:20am #3
  I see. I already use the resource way for icons and similar stuff.
  And I surly could rewrite my application regarding resource file handling (actually the application was not designed having AppImages in mind) but I assumed it should be very simple to access data files in the AppImage if I knew how to do it.
  I would also need to rethink some other ideas since I planned to integrate custom files with the AppImage via the AppImage creation script (without rebuilding the application).
  Is there really no easy solution for accessing data files within the AppImage?!
  probono April 23, 2018, 6:22am #4
  Silicomancer:
  AppDir/usr/share/appname/*.xml
  You can absolutely put it there if you like. But you need to make sure to load it from a path relative to your main application file, rather than from an absolute path or a path relative to the user's current directory (cwd).
  You could use QString QCoreApplication::applicationFilePath() and construct a relative path to ../share/kaidan/images/ from there.
  github.com/KaidanIM/Kaidan
  getResourcePath: Add binary relative paths
  Fixes #141.
  by lnjX on 11:19AM - 25 Nov 17 UTC
  As a result, it should work both in normal installations and in relocatable installations such as AppImages.