From 4ee9382c69854dac2b1a4fb875842d039785c978 Mon Sep 17 00:00:00 2001
From: Pete Jemian <prjemian@gmail.com>
Date: Sat, 17 Mar 2018 12:28:58 -0500
Subject: [PATCH] add paths only if they exist,

---
 EXAMPLE_start_caQtDM.sh | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/EXAMPLE_start_caQtDM.sh b/EXAMPLE_start_caQtDM.sh
index a23beda..48b32dc 100755
--- a/EXAMPLE_start_caQtDM.sh
+++ b/EXAMPLE_start_caQtDM.sh
@@ -21,14 +21,23 @@ function addModule
     # module_path is the path defined for that symbol in the RELEASE file
     module='$'$1
     module_path=`eval echo $module`
-    if [ "" == "${QTDMDP}" ]; then
-      QTDMDP=.
-    fi
-    if [ "" != "${module_path}" ]; then
-      if [ "" != "$2" ]; then
-        module_path=${module_path}/$2
-      fi
-      QTDMDP=${QTDMDP}:${module_path}
+
+    if [ "" != "${module}" ]; then
+        # module is required
+        addition=${module_path}
+        if [ "" != "$2" ]; then
+            # optional subdirectory path
+            addition+=/$2
+        fi
+        if [ -d "${addition}" ]; then
+            # proceed ONLY if new addition path exists
+            # Then, can define paths to all area detectors specific screens
+            if [ "" == "${QTDMDP}" ]; then
+                # no existing path defined, start here
+                QTDMDP=.
+            fi
+            QTDMDP+=:${addition}
+        fi
     fi
 }
 
-- 
GitLab