Added: #1440 Automatic standardization of paths in pipeline configuration sheets

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 0df1dbcb45
commit fed5c05538

@ -34,6 +34,7 @@
// NeL includes // NeL includes
// #include <nel/misc/debug.h> // #include <nel/misc/debug.h>
#include <nel/georges/u_form_elm.h> #include <nel/georges/u_form_elm.h>
#include <nel/georges/u_type.h>
#include <nel/net/service.h> #include <nel/net/service.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
@ -58,13 +59,30 @@ CPipelineProject::~CPipelineProject()
bool CPipelineProject::getValue(std::string &result, const std::string &name) bool CPipelineProject::getValue(std::string &result, const std::string &name)
{ {
NLGEORGES::UFormElm *valueElm;
if (!m_Form->getRootNode().getNodeByName(&valueElm, name.c_str()))
{
nlwarning("Node '%s' not found in '%s'", name.c_str(), m_Form->getFilename().c_str());
return false;
}
std::string value; std::string value;
if (!m_Form->getRootNode().getValueByName(value, name.c_str())) if (!valueElm->getValue(value))
{ {
nlwarning("Value '%s' not found in '%s'", name.c_str(), m_Form->getFilename().c_str()); nlwarning("Value '%s' not found in '%s'", name.c_str(), m_Form->getFilename().c_str());
return false; return false;
} }
parseValue(result, value); std::string parsed;
parseValue(parsed, value);
std::string typComment = valueElm->getType()->getComment();
if (typComment == "PIPELINE_PATH")
{
parsed = NLMISC::CPath::standardizePath(parsed, false);
}
else if (typComment == "PIPELINE_PATH_ENDSLASH")
{
parsed = NLMISC::CPath::standardizePath(parsed, true);
}
result = parsed;
return true; return true;
} }
@ -86,8 +104,15 @@ bool CPipelineProject::getValues(std::vector<std::string> &resultAppend, const s
resultAppend.reserve(resultAppend.size() + (std::vector<std::string>::size_type)size); resultAppend.reserve(resultAppend.size() + (std::vector<std::string>::size_type)size);
for (uint i = 0; i < size; ++i) for (uint i = 0; i < size; ++i)
{ {
NLGEORGES::UFormElm *valueElm;
if (!elm->getArrayNode(&valueElm, i))
{
nlwarning("Array node of node '%s' at '%i' not found in '%s'", name.c_str(), i, m_Form->getFilename().c_str());
resultAppend.resize(originalSize);
return false;
}
std::string value; std::string value;
if (!elm->getArrayValue(value, i)) if (!valueElm->getValue(value))
{ {
nlwarning("Array value of node '%s' at '%i' not found in '%s'", name.c_str(), i, m_Form->getFilename().c_str()); nlwarning("Array value of node '%s' at '%i' not found in '%s'", name.c_str(), i, m_Form->getFilename().c_str());
resultAppend.resize(originalSize); resultAppend.resize(originalSize);
@ -95,6 +120,15 @@ bool CPipelineProject::getValues(std::vector<std::string> &resultAppend, const s
} }
std::string parsed; std::string parsed;
parseValue(parsed, value); parseValue(parsed, value);
std::string typComment = valueElm->getType()->getComment();
if (typComment == "PIPELINE_PATH")
{
parsed = NLMISC::CPath::standardizePath(parsed, false);
}
else if (typComment == "PIPELINE_PATH_ENDSLASH")
{
parsed = NLMISC::CPath::standardizePath(parsed, true);
}
resultAppend.push_back(parsed); resultAppend.push_back(parsed);
} }
return true; return true;

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<DFN Revision="$Revision$" State="modified"> <DFN Revision="$Revision$" State="modified">
<ELEMENT Name="SrcDirectories" Type="Type" Filename="string.typ" Array="true"/> <ELEMENT Name="SrcDirectories" Type="Type" Filename="pipeline_path_endslash.typ" Array="true"/>
<ELEMENT Name="DstDirectory" Type="Type" Filename="string.typ"/> <ELEMENT Name="DstDirectory" Type="Type" Filename="pipeline_path_endslash.typ"/>
<COMMENTS>Test 123</COMMENTS> <COMMENTS>Test 123</COMMENTS>
<LOG>Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents = <LOG>Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents =
Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure = Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure =

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<DFN Revision="$Revision$" State="checked"> <DFN Revision="$Revision$" State="checked">
<ELEMENT Name="SrcDirectories" Type="Type" Filename="string.typ" Array="true"/> <ELEMENT Name="SrcDirectories" Type="Type" Filename="pipeline_path_endslash.typ" Array="true"/>
<ELEMENT Name="DstFile" Type="Type" Filename="string.typ"/> <ELEMENT Name="DstFile" Type="Type" Filename="pipeline_path.typ"/>
<COMMENTS>dfsd</COMMENTS> <COMMENTS>dfsd</COMMENTS>
<LOG>Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents = <LOG>Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents =
Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure = Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure =

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<TYPE Type="String" UI="Edit" Version="0.0" State="modified">
<COMMENTS>PIPELINE_PATH</COMMENTS>
<LOG></LOG>
</TYPE>

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<TYPE Type="String" UI="Edit" Version="0.0" State="modified">
<COMMENTS>PIPELINE_PATH_ENDSLASH</COMMENTS>
<LOG></LOG>
</TYPE>

@ -2,7 +2,7 @@
<DFN Revision="$Revision$" State="modified"> <DFN Revision="$Revision$" State="modified">
<ELEMENT Name="Description" Type="Type" Filename="string.typ"/> <ELEMENT Name="Description" Type="Type" Filename="string.typ"/>
<ELEMENT Name="Macros" Type="Dfn" Filename="pipeline_macro.dfn" Array="true"/> <ELEMENT Name="Macros" Type="Dfn" Filename="pipeline_macro.dfn" Array="true"/>
<ELEMENT Name="DependentProjects" Type="Type" Filename="filename.typ" Array="true"/> <ELEMENT Name="DependentProjects" Type="Type" Filename="filename.typ" FilenameExt="*.pipeline_project" Array="true"/>
<ELEMENT Name="Processes" Type="Type" Filename="string.typ" Array="true"/> <ELEMENT Name="Processes" Type="Type" Filename="string.typ" Array="true"/>
<ELEMENT Name="Interface" Type="Dfn" Filename="pipeline_process_interface.dfn"/> <ELEMENT Name="Interface" Type="Dfn" Filename="pipeline_process_interface.dfn"/>
<LOG>Sat Feb 18 13:35:41 2012 (Kaetemi) Dfn Structure = <LOG>Sat Feb 18 13:35:41 2012 (Kaetemi) Dfn Structure =

Loading…
Cancel
Save