In order to solve this issue, I would need to programmatically get the -output-directory when running a commands like:
$ pdflatex -shell-escape -output-directory=build test.tex
The reason is that I would need to change commands run via \write18 depending on the location of the build folder.
(I also tried to directly read ${TEXMF_OUTPUT_DIRECTORY} from the command line, but this environment variable is empty as well: EDIT after checking the source, this seems to be available starting from TexLive 2024)
--output-directoryoption. – Ulrike Fischer Jan 16 '24 at 09:35currfileabsdiris a very fancy trick, nice one! Thanks! – tobiasBora Feb 14 '24 at 00:35