From fed5c05538a4b1c989e82c9c137e17a9b40473a3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 3 Mar 2012 15:03:10 +0100 Subject: [PATCH] Added: #1440 Automatic standardization of paths in pipeline configuration sheets --HG-- branch : build_pipeline_v3 --- .../pipeline/service/pipeline_project.cpp | 40 +++++++++++++++++-- .../DFN/pipeline/pipeline_common_id_od.dfn | 4 +- .../DFN/pipeline/pipeline_common_id_of.dfn | 4 +- .../DFN/pipeline/pipeline_path.typ | 5 +++ .../DFN/pipeline/pipeline_path_endslash.typ | 5 +++ .../DFN/pipeline/pipeline_project.dfn | 2 +- 6 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path.typ create mode 100644 code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path_endslash.typ diff --git a/code/nel/tools/pipeline/service/pipeline_project.cpp b/code/nel/tools/pipeline/service/pipeline_project.cpp index a6f1d731e..ee8aae6da 100644 --- a/code/nel/tools/pipeline/service/pipeline_project.cpp +++ b/code/nel/tools/pipeline/service/pipeline_project.cpp @@ -34,6 +34,7 @@ // NeL includes // #include #include +#include #include #include #include @@ -58,13 +59,30 @@ CPipelineProject::~CPipelineProject() 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; - 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()); 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; } @@ -86,8 +104,15 @@ bool CPipelineProject::getValues(std::vector &resultAppend, const s resultAppend.reserve(resultAppend.size() + (std::vector::size_type)size); 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; - 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()); resultAppend.resize(originalSize); @@ -95,6 +120,15 @@ bool CPipelineProject::getValues(std::vector &resultAppend, const s } 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); + } resultAppend.push_back(parsed); } return true; diff --git a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_od.dfn b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_od.dfn index 8bbe989ff..21e2ac3bb 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_od.dfn +++ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_od.dfn @@ -1,7 +1,7 @@ - - + + Test 123 Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents = Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure = diff --git a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_of.dfn b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_of.dfn index 43b2fd17e..c157ef6e0 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_of.dfn +++ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_common_id_of.dfn @@ -1,7 +1,7 @@ - - + + dfsd Sat Feb 18 13:50:40 2012 (Kaetemi) Dfn Parents = Sat Feb 18 13:58:21 2012 (Kaetemi) Dfn Structure = diff --git a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path.typ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path.typ new file mode 100644 index 000000000..93ebb9650 --- /dev/null +++ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path.typ @@ -0,0 +1,5 @@ + + + PIPELINE_PATH + + diff --git a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path_endslash.typ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path_endslash.typ new file mode 100644 index 000000000..f7091e4d2 --- /dev/null +++ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_path_endslash.typ @@ -0,0 +1,5 @@ + + + PIPELINE_PATH_ENDSLASH + + diff --git a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_project.dfn b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_project.dfn index 1e1c22922..9af98130e 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_project.dfn +++ b/code/ryzom/common/data_leveldesign/leveldesign/DFN/pipeline/pipeline_project.dfn @@ -2,7 +2,7 @@ - + Sat Feb 18 13:35:41 2012 (Kaetemi) Dfn Structure =