From 6d653f720d184d8bf29690719597a5ff35149888 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 14 Oct 2010 21:55:24 -0400 Subject: [PATCH] Sync - Now verifies that any potential subst is not also a valid absolute path. --- src/Subst.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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;