From 020d5f9b2d342a02302c2d67246a162324549896 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Thu, 19 May 2011 17:32:57 +0200
Subject: [PATCH] EHN: preserve WM_PROJECT_SITE in bashrc, cshrc

- otherwise there is actually no means of placing a site-site
  prefs.sh in the $WM_PROJECT_SITE/ directory
---
 etc/bashrc |  7 ++++++-
 etc/cshrc  | 10 ++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/etc/bashrc b/etc/bashrc
index 6cd4d8a8cfa..edebe538fce 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -120,7 +120,12 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
 # Location of site-specific templates etc
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # unset is equivalent to $WM_PROJECT_INST_DIR/site
-unset WM_PROJECT_SITE
+if [ -d "$WM_PROJECT_SITE" ]
+then
+    export WM_PROJECT_SITE
+else
+    unset WM_PROJECT_SITE
+fi
 
 # Location of user files
 # ~~~~~~~~~~~~~~~~~~~~~~
diff --git a/etc/cshrc b/etc/cshrc
index 8e2597e9012..658f93da69e 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -107,9 +107,6 @@ if ( $?WM_PROJECT_INST_DIR ) then
         set foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
     endif
 endif
-if ( $?WM_PROJECT_SITE ) then
-    set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs"
-endif
 
 
 # Location of installation
@@ -124,7 +121,12 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
 # Location of site-specific templates etc
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # unset is equivalent to $WM_PROJECT_INST_DIR/site
-unsetenv WM_PROJECT_SITE
+if ( $?WM_PROJECT_SITE ) then
+    set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs"
+    if ( ! -d "$WM_PROJECT_SITE" ) unsetenv WM_PROJECT_SITE
+else
+    unsetenv WM_PROJECT_SITE
+endif
 
 # Location of user files
 # ~~~~~~~~~~~~~~~~~~~~~~
-- 
GitLab