From 31dfc19fcb108c616a2a21f68bbb0548e659b80d Mon Sep 17 00:00:00 2001
From: bugmaster <bugmaster@opencascade.com>
Date: Tue, 24 Nov 2015 15:25:47 +0300
Subject: [PATCH] Copy env.bat file from adm/templates

---
 genproj.bat | 2 ++
 genproj.sh  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/genproj.bat b/genproj.bat
index 0610af624d..79eec0e86e 100644
--- a/genproj.bat
+++ b/genproj.bat
@@ -7,6 +7,8 @@ SET "OLD_PATH=%PATH%"
 
 if exist "%~dp0env.bat" (
   call "%~dp0env.bat"
+) else (
+   type "%~dp0adm\templates\env.bat" | findstr /i /v "__CASROOT__" > "%~dp0env.bat"
 )
 
 set "TCL_EXEC=tclsh.exe"
diff --git a/genproj.sh b/genproj.sh
index 91576ca24a..2800bde898 100755
--- a/genproj.sh
+++ b/genproj.sh
@@ -9,6 +9,9 @@ anOldDyLd="$DYLD_LIBRARY_PATH"
 
 # go to the script directory
 aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
+if [ ! -e "${aScriptPath}/env.sh" ]; then 
+cat ${aScriptPath}/adm/templates/env.sh | sed -e '/__CASROOT__/d' > ${aScriptPath}/env.sh
+fi
 
 aSystem=`uname -s`
 aTarget="$1"