diff --git a/src/Subst.cpp b/src/Subst.cpp index 0135c575c..9c61ba542 100644 --- a/src/Subst.cpp +++ b/src/Subst.cpp @@ -25,11 +25,12 @@ // //////////////////////////////////////////////////////////////////////////////// -#include "Subst.h" -#include "Nibbler.h" -#include "Context.h" -#include "text.h" -#include "i18n.h" +#include +#include +#include +#include +#include +#include extern Context context; @@ -74,6 +75,9 @@ Subst::~Subst () } //////////////////////////////////////////////////////////////////////////////// +// A Path and a Subst may look similar, and so the rule is that if a Subst looks +// like a path, it must also not exist in the file system in order to actually +// be a Subst. bool Subst::valid (const std::string& input) const { std::string ignored; @@ -85,7 +89,8 @@ bool Subst::valid (const std::string& input) const n.skip ('/')) { n.skip ('g'); - return true; + if (n.depleted ()) + return ! Directory (input).exists (); } return false;