mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Sync
- Now verifies that any potential subst is not also a valid absolute path.
This commit is contained in:
parent
4e62d8fddc
commit
6d653f720d
1 changed files with 11 additions and 6 deletions
|
@ -25,11 +25,12 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Subst.h"
|
||||
#include "Nibbler.h"
|
||||
#include "Context.h"
|
||||
#include "text.h"
|
||||
#include "i18n.h"
|
||||
#include <Subst.h>
|
||||
#include <Nibbler.h>
|
||||
#include <Directory.h>
|
||||
#include <Context.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue