From 2b6651a116e2b24301916c623fd9b14afe3b35c4 Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Wed, 21 Sep 2011 12:32:30 +0200
Subject: [PATCH] ENH: supress ":" at the end of the path, trouble on windows

---
 .../otbWrapperCommandLineLauncher.cxx         | 20 ++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx
index 80125c1c80..38db567cdb 100644
--- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx
+++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx
@@ -237,7 +237,10 @@ CommandLineLauncher::LoadPath()
     for( unsigned i=0; i<pathList.size(); i++)
       {
       m_Path.append(pathList[i]);
-      m_Path.append(":");
+      if( i < pathList.size()-1 )
+        {
+        m_Path.append(":");
+        }
       }
 
     std::string specificEnv("ITK_AUTOLOAD_PATH=");
@@ -270,12 +273,19 @@ CommandLineLauncher::LoadApplication()
     std::cerr << "ERROR: Module search path: "<< itksys::SystemTools::GetEnv("ITK_AUTOLOAD_PATH") << std::endl;
     
     std::vector<std::string> list = ApplicationRegistry::GetAvailableApplications();
-    std::cerr << "ERROR: Available modules : " << (list.empty() ? "None" : "") << std::endl;
-    for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
+    if( list.size() == 0 )
       {
-      std::cout << "\t" << *it << std::endl;
+      std::cerr << "ERROR: Available modules : none." << std::endl;
+      }
+    else
+      {
+      std::cerr << "ERROR: Available modules :" << std::endl;
+      for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
+        {
+        std::cout << "\t" << *it << std::endl;
+        }
+      return;
       }
-    return;
     }
 
   // Attach log output to the Application logger
-- 
GitLab