- Now verifies that any potential subst is not also a valid absolute
  path.
This commit is contained in:
Paul Beckingham
2010-10-14 21:55:24 -04:00
parent 4e62d8fddc
commit 6d653f720d

View File

@@ -25,11 +25,12 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "Subst.h" #include <Subst.h>
#include "Nibbler.h" #include <Nibbler.h>
#include "Context.h" #include <Directory.h>
#include "text.h" #include <Context.h>
#include "i18n.h" #include <text.h>
#include <i18n.h>
extern Context context; 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 bool Subst::valid (const std::string& input) const
{ {
std::string ignored; std::string ignored;
@@ -85,7 +89,8 @@ bool Subst::valid (const std::string& input) const
n.skip ('/')) n.skip ('/'))
{ {
n.skip ('g'); n.skip ('g');
return true; if (n.depleted ())
return ! Directory (input).exists ();
} }
return false; return false;