PATH issue in appImage app?

Hello.
I have an issue with my C application.
Inside the code I test if gnuplot exists with something like that:

	gchar *str = g_strdup("gnuplot -e > /dev/null 2>&1");

	int retval = system(str);
	g_free(str);
	if (WIFEXITED(retval))
		return 0 == WEXITSTATUS(retval);
	return FALSE;

Of course it works well in Linux, except when I build the app as an appImage. I think it is a PATH issue (looking in the /usr/bin of the bundle??) but I don’t know how I can solve it.
What is the correct way to do it?

Thx a lot.

Welcome back @lock042!

Where is that gnuplot located? Inside or outside the AppImage? Since gnuplot cannot be expected to come with all Linux distributions by default, you should bundle it (and its dependencies) inside your AppImage.

You need to put it onto the $PATH so that your code works.

Or change the code to check for <location from which the current application is running>/gnuplot.

Check c++ - Finding current executable's path without /proc/self/exe - Stack Overflow for getting the location from which the current application is running.