I would like to test whether the string in \expandafter\long\expandafter\xdef\csname\currfilebase\Introduction is empty so that the section is not displayed. This environment introduction is defined in a file in P/Fourier.tex. Of course, what I did here does not work. I have tried many if the \if... commands from etoolbox but all seem to not work. (tried here).
\documentclass[11pt]{scrreprt}
\usepackage{currfile}
\usepackage{filehook}
\usepackage{environ}
\usepackage{etoolbox}
\def\Introduction{Introduction}
\NewEnviron{introduction}{%
\expandafter\long\expandafter\xdef\csname\currfilebase\Introduction \endcsname{\expandafter\unexpanded\expandafter{\BODY}}%
}%
\AtEndOfIncludes{%
\ifcurrfiledir{P/}{%
\ifdefequal{\csname\currfilebase\Introduction\endcsname}{ }{True}{False}%
\section{Introduction}%
\csname \currfilebase \Introduction \endcsname}%
}%
\begin{document}
\include{P/Fourier}
\end{document}
And P/Fourier.tex contains
\begin{introduction}
Test
\end{introduction}
I have a couple of those environment and I wish that they are not shown in the final pdf. So I have something like this if the file is empty:

Edit: Fixed the missing } and removed an irrelevant line.
Edit #2: I have changed this to the following code (with etoolbox):
\ifcsvoid{\currfilebase\Introduction}{}{%
\section{Introduction}%
\csname\currfilebase\Introduction\endcsname}%
This seems to work! Is this a good way of doing things? Thanks guys, now I have also learned \show which helped a lot!
Edit #3: Since I am already using etoolbox I can do use all others commands as well anyway, so
\newcommand{\makesection}[1]{\ifcsvoid{\currfilebase#1}{}%
{%
\section{#1}%
\csuse{\currfilebase#1}%
}%
}%
(I have done the same in the rest too)

\include{P/Fourier}in your code and replace it by a small section of document that shows the problem? as it is, we can't run it. – David Carlisle Jul 22 '12 at 9:55\expandafter\ifx\expandafter\relax\csname\currfilebase\Introduction\endcsname\relax TRUE \else FALSE \ficould do the trick. But I can't test it right now. – canaaerus Jul 22 '12 at 10:10