#include "../../Utils/senfassert.hh"
#include "../../Utils/Range.hh"
#include "../../Utils/String.hh"
+#include "../../Utils/range.hh"
//#include "Executor.mpp"
#define prefix_
path.begin(),
boost::prior(path.end())),
dir);
+ // For auto-cd support we need to check against '.' and '..' here too
+ Token const & tok (*boost::prior(path.end()));
+ if (tok == WordToken("..")) {
+ if (dir.size() > 1)
+ dir.pop_back();
+ return *dir.back().lock();
+ }
DirectoryNode & base (*dir.back().lock());
- std::string const & name (complete(base, boost::prior(path.end())->value()));
+ if (tok == WordToken("."))
+ return base;
+ std::string const & name (complete(base, tok.value()));
if (policy_)
policy_( base, name );
return dir.back().lock()->get(name);
{
if (! dir.hasChild(name)) {
DirectoryNode::ChildrenRange completions (dir.completions(name));
- if (completions.size() == 1)
+ if (has_one_elt(completions))
return completions.begin()->first;
}
return name;