From 315e4ee27167bcd76c6ee1d93a83f8332c12ede5 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Tue, 6 Aug 2019 17:39:42 +0200
Subject: [PATCH] BUG: fix otbenv.bat, problem with closing parenthesis in PATH

---
 Packaging/Files/otbenv.bat | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Packaging/Files/otbenv.bat b/Packaging/Files/otbenv.bat
index d5aac56d30..6b4efefb22 100644
--- a/Packaging/Files/otbenv.bat
+++ b/Packaging/Files/otbenv.bat
@@ -16,7 +16,7 @@
 :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 :: See the License for the specific language governing permissions and
 :: limitations under the License.
-
+@echo off
 :: Setup environment for OTB package
 set CURRENT_SCRIPT_DIR=%~dp0
 
@@ -36,7 +36,11 @@ setlocal enabledelayedexpansion
 set output=%~2
 set var=%1
 set content=
-if defined %var% ( set content=!%var%! )
-if not "%content%" == "" ( set output=%output%;%content% )
+if not defined %var% ( goto :prefix_path_testcontent )
+set content=!%var%!
+:prefix_path_testcontent
+if "%content%" == "" ( goto :prefix_path_end )
+set output=%output%;%content%
+:prefix_path_end
 endlocal & set %1=%output%
 goto :eof
-- 
GitLab