Salome HOME
BUG NPPAL 16048 T15881 T32x_16Aug2007_16h00m T_13901 T_24092007 T_reliquat_2007 V3_2_7 V3_2_7rc1
authorcrouzet <crouzet>
Mon, 4 Jun 2007 10:24:44 +0000 (10:24 +0000)
committercrouzet <crouzet>
Mon, 4 Jun 2007 10:24:44 +0000 (10:24 +0000)
new treatment of HXX2SALOME_ROOT_DIR variable to add /bin if necessary.

scripts/hxx2salome

index bc2e588df5bc92d64c75e76f801b047363f737f5..964ce0f041465b8d7b8250817db791af626a6f95 100755 (executable)
@@ -481,17 +481,38 @@ else
    fi
 fi
 
+# look up hxx2salome scripts
+#   - first search in directory ${HXX2SALOME_ROOT_DIR} (if the variable is defined)
+#   - then search in directory ${HXX2SALOME_ROOT_DIR}/bin
+#   - finally seach locally.
 #
 if [ ${HXX2SALOME_ROOT_DIR} ] && [ -d ${HXX2SALOME_ROOT_DIR} ]
 then
-    gene_dir=${HXX2SALOME_ROOT_DIR}
+    echo "    HXX2SALOME_ROOT_DIR variable is defined : ${HXX2SALOME_ROOT_DIR}  => we look up hxx2salome scripts inside"
+    if [ -f ${HXX2SALOME_ROOT_DIR}/parse1.awk -a  -f ${HXX2SALOME_ROOT_DIR}/parse2.awk ] # check if script are found in ${HXX2SALOME_ROOT_DIR}
+    then
+       gene_dir=${HXX2SALOME_ROOT_DIR}
+    elif [ -f ${HXX2SALOME_ROOT_DIR}/bin/parse1.awk -a  -f ${HXX2SALOME_ROOT_DIR}/bin/parse2.awk ] # else check /bin directory
+    then
+       gene_dir=${HXX2SALOME_ROOT_DIR}/bin
+    else
+       echo -e "\nError : Variable HXX2SALOME_ROOT_DIR not correctly set"
+       usage
+    fi
 else
-    gene_dir=`pwd` # case where hxx2salome was launched from HXX2SALOME directory
+    echo "HXX2SALOME_ROOT_DIR directory not set  => we look up hxx2salome scripts locally"
+    if [  -f parse1.awk -a  -f parse2.awk ] # check if script are found locally
+    then
+       gene_dir=`pwd` # case where hxx2salome was launched from HXX2SALOME directory
+    else
+       echo -e "\nError : Variable HXX2SALOME_ROOT_DIR is not set, and hxx2salome didn't find his scripts locally"
+       usage
+    fi
 fi
-echo "    hxx2salome directory : $gene_dir"
-if [ ! -f ${gene_dir}/parse1.awk -o ! -f ${gene_dir}/parse2.awk ] # check if script are found
+echo "    hxx2salome directory found : $gene_dir"
+if [ ! -f ${gene_dir}/parse3.awk -o ! -f ${gene_dir}/template_src.tgz ] # final check
 then
-    echo -e "\nError : Variable HXX2SALOME_ROOT_DIR shoud be set, or hxx2salome should be launched localy from bin directory"
+    echo -e "\nError : scripts parse3.awk or template_src.tgz not present in hxx2salome directory  : $gene_dir"
     usage
 fi
 #