diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index 3d822ec0a..ebecfddc0 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -474,7 +474,7 @@ int main(int nNbArg, char **ppArgs) string findTGAName; for (i = 0; i < mapSize; ++i) { - // get the string whitout path + // get the string without path findTGAName = toLower(CFile::getFilename(AllMapNames[i])); if( findTGAName == sTGAname ) break; diff --git a/code/nel/tools/pipeline/plugin_library/pipeline_process.h b/code/nel/tools/pipeline/plugin_library/pipeline_process.h index 10acabbbe..b546de19f 100644 --- a/code/nel/tools/pipeline/plugin_library/pipeline_process.h +++ b/code/nel/tools/pipeline/plugin_library/pipeline_process.h @@ -81,6 +81,9 @@ public: /// Get the temporary directory for the current process. The directory must be deleted when the process ends. May return random temporary directories if no process is running. virtual std::string getTempDirectory() = 0; + + /// Delete a directory if it's empty + virtual void deleteDirectoryIfEmpty(const std::string &path) = 0; /// Get a value from the currently active project configuration. If false, don't use, no need to write warnings to service log, already written, set exit state and exit if necessary virtual bool getValue(std::string &result, const std::string &name) = 0; diff --git a/code/nel/tools/pipeline/plugin_nel/process_interface.cpp b/code/nel/tools/pipeline/plugin_nel/process_interface.cpp index 9f7b5de82..cc76bbebc 100644 --- a/code/nel/tools/pipeline/plugin_nel/process_interface.cpp +++ b/code/nel/tools/pipeline/plugin_nel/process_interface.cpp @@ -51,11 +51,11 @@ CProcessInterface::~CProcessInterface() } -void CProcessInterface::buildAtlas(const std::vector &srcDirectories, const std::string &dstFile) +void CProcessInterface::buildAtlas(const std::string &dependLog, const std::string &errorLog, const std::vector &srcDirectories, const std::string &dstFile) { nldebug("Build atlas '%s'", dstFile.c_str()); std::stringstream ss; - ss << "build_interface " << dstFile; + ss << "build_interface -d" << dependLog << " -e" << errorLog << " " << dstFile; for (std::vector::const_iterator it = srcDirectories.begin(), end = srcDirectories.end(); it != end; ++it) { const std::string &path = *it; @@ -68,6 +68,10 @@ void CProcessInterface::build() { nldebug("Building process interface!"); + std::string tempDir = m_PipelineProcess->getTempDirectory(); + std::string dependLog = tempDir + "depend.log"; + std::string errorLog = tempDir + "error.log"; + { uint nb; if (m_PipelineProcess->getValueNb(nb, "Interface.Atlas")) @@ -86,17 +90,21 @@ void CProcessInterface::build() ss << "Interface.Atlas[" << i << "].DstFile"; if (!m_PipelineProcess->getValue(dstFile, ss.str())) break; } - if (m_PipelineProcess->needsToBeRebuilt(srcDirectories, dstFile)) + std::vector dstFiles; + dstFiles.push_back(dstFile); // .tga + dstFiles.push_back(dstFile.substr(0, dstFile.size() - 3) + "txt"); // .txt + if (m_PipelineProcess->needsToBeRebuilt(srcDirectories, dstFiles)) { - m_PipelineProcess->makePaths(dstFile); - buildAtlas(srcDirectories, dstFile); + m_PipelineProcess->makePaths(dstFiles); + buildAtlas(dependLog, errorLog, srcDirectories, dstFile); m_PipelineProcess->parseToolLog("", "", false); } if (m_PipelineProcess->needsExit()) return; } } } - + + m_PipelineProcess->deleteDirectoryIfEmpty(tempDir); m_PipelineProcess->setExit(FINISH_ERROR, "Not yet implemented"); } diff --git a/code/nel/tools/pipeline/plugin_nel/process_interface.h b/code/nel/tools/pipeline/plugin_nel/process_interface.h index d69b95041..a2e426798 100644 --- a/code/nel/tools/pipeline/plugin_nel/process_interface.h +++ b/code/nel/tools/pipeline/plugin_nel/process_interface.h @@ -50,7 +50,7 @@ public: CProcessInterface(); virtual ~CProcessInterface(); - void buildAtlas(const std::vector &srcDirectories, const std::string &dstFile); + void buildAtlas(const std::string &dependLog, const std::string &errorLog, const std::vector &srcDirectories, const std::string &dstFile); virtual void build(); diff --git a/code/nel/tools/pipeline/service/pipeline_process_impl.cpp b/code/nel/tools/pipeline/service/pipeline_process_impl.cpp index 87b822b44..49ef18f6c 100644 --- a/code/nel/tools/pipeline/service/pipeline_process_impl.cpp +++ b/code/nel/tools/pipeline/service/pipeline_process_impl.cpp @@ -100,6 +100,20 @@ std::string CPipelineProcessImpl::getTempDirectory() } } +void CPipelineProcessImpl::deleteDirectoryIfEmpty(const std::string &path) +{ + std::vector dummy; + NLMISC::CPath::getPathContent(path, false, true, true, dummy); + if (dummy.size()) + { + nlwarning("Directory '%s' not empty", path.c_str()); + } + else + { + NLMISC::CFile::deleteDirectory(path); + } +} + bool CPipelineProcessImpl::getValue(std::string &result, const std::string &name) { if (m_ActiveProject == NULL) diff --git a/code/nel/tools/pipeline/service/pipeline_process_impl.h b/code/nel/tools/pipeline/service/pipeline_process_impl.h index 025712ff8..325eb790b 100644 --- a/code/nel/tools/pipeline/service/pipeline_process_impl.h +++ b/code/nel/tools/pipeline/service/pipeline_process_impl.h @@ -60,6 +60,7 @@ public: virtual std::string getOutputDirectory(); virtual std::string getTempDirectory(); + virtual void deleteDirectoryIfEmpty(const std::string &path); virtual bool getValue(std::string &result, const std::string &name); virtual bool getValues(std::vector &resultAppend, const std::string &name); virtual bool getValueNb(uint &result, const std::string &name); diff --git a/code/nel/tools/pipeline/service/pipeline_process_impl_toollog.cpp b/code/nel/tools/pipeline/service/pipeline_process_impl_toollog.cpp index 078d50883..4324d488e 100644 --- a/code/nel/tools/pipeline/service/pipeline_process_impl_toollog.cpp +++ b/code/nel/tools/pipeline/service/pipeline_process_impl_toollog.cpp @@ -47,7 +47,8 @@ namespace PIPELINE { void CPipelineProcessImpl::parseToolLog(const std::string &dependLogFile, const std::string &errorLogFile, bool writeOutputMeta) { - m_SubTaskResult = FINISH_SUCCESS; + m_SubTaskErrorMessage = "Log parsing not implemented, goodbye"; + m_SubTaskResult = FINISH_ERROR; } } /* namespace PIPELINE */