Fix Parser storing context path wrongly
Parser was storing its context path as a relative path and manually
prepending a slash to it, when it was retrieved. Parser now correctly
stores it as absolute path and lets the convertor function add the
slash.
Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/145
Change-Id: If38c009a05a8ecbc2be00d646172e0ae97de748b
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 3630c25..61604bb 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -109,7 +109,7 @@
std::string Interpreter::absolutePathFromCommand(const T& command) const
{
if (command.m_path.m_scope == Scope::Absolute)
- return "/" + pathToDataString(command.m_path);
+ return pathToDataString(command.m_path);
else
return joinPaths(m_parser.currentNode(), pathToDataString(command.m_path));
}
@@ -143,14 +143,13 @@
const auto path = *get.m_path;
if (path.type() == typeid(module_)) {
return "/"s + boost::get<module_>(path).m_name + ":*";
-
} else {
auto actualPath = boost::get<boost::variant<dataPath_, schemaPath_>>(path);
std::string pathString = boost::apply_visitor(pathToStringVisitor(), actualPath);
auto pathScope{boost::apply_visitor(getPathScopeVisitor(), actualPath)};
if (pathScope == Scope::Absolute) {
- return "/" + pathString;
+ return pathString;
} else {
return joinPaths(m_parser.currentNode(), pathString);
}