29 #include <SimoxUtility/algorithm/string/string_tools.h>
34 #define ARMARX_PACKAGE_TOOL "armarx-package"
44 if (!std::filesystem::exists(packageToolPath))
60 if (!std::filesystem::exists(pathToPackageRoot))
65 std::string cmd = packageToolPath +
" status --dir \"" + pathToPackageRoot +
"\"";
87 std::string escapedStatePath = simox::alg::replace_all(statePath,
" ",
"\\ ");
88 std::string escapedStatechartGroupName = simox::alg::replace_all(statechartGroupName,
" ",
"\\ ");
89 std::string cmd = packageToolPath +
" add statechart " + escapedStatechartGroupName +
"/" + escapedStatePath +
" -l " + escapedStatechartGroupName;
91 if (!packagePath.empty())
93 if (!std::filesystem::exists(packagePath))
97 cmd +=
" --dir " + packagePath;
107 return addXmlStatechart(
"xmlstate",
"default", statechartGroupName, statePath, packagePath);
112 return addXmlStatechart(
"xmlstate-xmlonly",
"xmlonly", statechartGroupName, statePath, packagePath);
117 return addXmlStatechart(
"xmlstate",
"cpponly", statechartGroupName, statePath, packagePath);
125 bool ArmarXPackageToolInterface::addXmlStatechart(
const std::string& componentType,
const std::string& replacementStrategyType,
const std::string& statechartGroupName,
const std::string& statePath,
const std::string& packagePath)
const
128 std::string escapedStatePath = simox::alg::replace_all(statePath,
" ",
"\\ ");
129 std::string escapedStatechartGroupName = simox::alg::replace_all(statechartGroupName,
" ",
"\\ ");
130 std::string cmd = packageToolPath +
" add " + componentType +
" " + escapedStatechartGroupName +
"/" + escapedStatePath +
" -l " + escapedStatechartGroupName +
" -s " + replacementStrategyType;
132 if (!packagePath.empty())
134 cmd +=
" --dir " + packagePath;
138 ARMARX_INFO <<
"Executed:\n" << cmd <<
"\nreturned = " << result;