From 42a4b3d3b3d63bcdad2edd915dca0adecc615a88 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Tue, 30 Jun 2015 11:04:07 +0200
Subject: [PATCH] BUG: avoid ITK_AUTOLOAD_PATH growth at each otbcli/otbgui.bat
 call

---
 CMake/otbcli.bat.in | 2 ++
 CMake/otbgui.bat.in | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/CMake/otbcli.bat.in b/CMake/otbcli.bat.in
index f562f96f1e..c5916b03b7 100644
--- a/CMake/otbcli.bat.in
+++ b/CMake/otbcli.bat.in
@@ -14,6 +14,7 @@ if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherCommandLine.exe (
   set OTB_CLI_LAUNCHER=otbApplicationLauncherCommandLine.exe
 )
 
+setlocal
 :: works for install tree
 if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
   set ITK_AUTOLOAD_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%ITK_AUTOLOAD_PATH%
@@ -21,3 +22,4 @@ if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
 
 :: start the application
 %OTB_CLI_LAUNCHER% %*
+endlocal
diff --git a/CMake/otbgui.bat.in b/CMake/otbgui.bat.in
index 499378dec1..a53233b124 100644
--- a/CMake/otbgui.bat.in
+++ b/CMake/otbgui.bat.in
@@ -14,6 +14,7 @@ if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherQt.exe (
   set OTB_GUI_LAUNCHER=otbApplicationLauncherQt.exe
 )
 
+setlocal
 :: works for install tree
 if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
   set ITK_AUTOLOAD_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%ITK_AUTOLOAD_PATH%
@@ -23,3 +24,4 @@ set LC_NUMERIC=C
 
 :: start the application
 %OTB_GUI_LAUNCHER% %*
+endlocal
-- 
GitLab