After using the answer of Using \nameref within \path I tried to use that command inside a 'pgfplots' table as file name. Here's the (shortened) code:
\newcommand*{\expath}[1]{/Users/jo/{#1}}
\expath{folder/file.csv} %line 3
\begin{tikzpicture}
\begin{axis}
\addplot
table {\expath{folder/file.csv}}; %line 8
\end{axis}
\end{tikzpicture}
While line 3 prints /Users/jo/folder/file.csv as expected, line 8 throws an error saying could not read table file '/Users/jo/{folder/file.csv}' (note the extra { and }).
What's going wrong here?
Update:
Using \expath inside another command like \input is also not working. The error message there prints the right path to a file (no extra brackets there), but still says file not found...
\input{\expath{subpath/to/file.tex}}