I have a C program that I want to package into an AppImage file. I am attempting to use linuxdeploy and appimagetool to create the AppImage for my program.
It has worked so far, but I do not know how to put resource files that are needed by my C program into the AppImage, nor do I know what code to use to load the files.
Currently, the code I am using to access the resource is this:
#include <stdio.h>
int main() {
FILE *file = fopen("resource.txt", "r"); //resource file is in the same directory as program
//more code to read file
fclose(file);
return 0;
}
I was package my program into an AppImage with these commands:
gcc program.c -o myprogram
./linuxdeploy-x86_64.AppImage --executable myprogram --desktop-file mydesktopfile --icon icon.png --appdir MyProgram.AppDir
ARCH=x86_64 ./appimagetool-x86_64.AppImage MyProgram.AppDir
Some other relevant info:
- I am using Debian 12 linux
- My computer architecture is x86_64
- All of the program files are in the same directory, laid out next to each other
- I have statically compiled the program, so the inclusion of libraries shouldn't be necessary
How should I package my program so it can still access the resource file, and how should I modify my code to read the resource file?