From 051e9d4e58803eec68494b164afc065244de4a0d Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Tue, 27 Mar 2018 18:57:16 +0200
Subject: [PATCH] BUG: fix handling of relative path, use dedicated macro for
 logs

---
 Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx
index ebece9e026..b57518ed73 100644
--- a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx
+++ b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx
@@ -22,6 +22,7 @@
 #define otbMPIVrtWriter_txx
 
 #include "otbMPIVrtWriter.h"
+#include "otbMacro.h"
 
 namespace otb
 {
@@ -163,11 +164,10 @@ MPIVrtWriter<TImage>::Update()
 	}
   }
   std::vector<std::string> joins;
-  joins.push_back(itksys::SystemTools::GetFilenamePath(output).append("/"));
-  joins.push_back(itksys::SystemTools::GetFilenameWithoutExtension(output));
+  itksys::SystemTools::SplitPath(output, joins);
+  joins.back() = itksys::SystemTools::GetFilenameWithoutExtension(output);
   std::string prefix = itksys::SystemTools::JoinPath(joins);
 
-
   // Data type
   std::string dataTypeStr = "Float32";
   GDALImageIO::Pointer gdalImageIO;
@@ -287,7 +287,7 @@ MPIVrtWriter<TImage>::Update()
           int tileIndexY = currentRegion.GetIndex()[1];
           std::stringstream tileFileName;
           tileFileName <<prefix<<"_"<<tileIndexX<<"_"<<tileIndexY<<"_"<<tileSizeX<<"_"<<tileSizeY<<".tif";
-          std::cout<<tileFileName.str()<<std::endl;
+          otbDebugMacro(<<tileFileName.str());
 
           GDALDataset *dataset = (GDALDataset*) GDALOpen(tileFileName.str().c_str(), GA_ReadOnly);
 
-- 
GitLab