I'm generating a Gnuplot script in the same folder as a .dat file that I need to plot, and I'd like it to work even if it's called from a different directory. Unfortunately it seems like relative paths work from the directory within which Gnuplot is called, not the one in which the script file is. So for example:
gnuplot folder/script.gp
will fail if the file is folder/data.dat and the script says plot "data.dat". Is there any way to get around this? Like a variable in Gnuplot holding the location of the currently executed script?