ENH: improvements for FOAM_CONFIG_ETC
- handle relative directory names for FOAM_CONFIG_ETC
This commit is contained in:
parent
6a1efe3b5c
commit
a6e86caa62
@ -68,6 +68,7 @@ options:
|
||||
-config Add config directory prefix for shell type:
|
||||
with -csh* for a config.csh/ prefix
|
||||
with -sh* for a config.sh/ prefix
|
||||
-etc=[DIR] set/unset FOAM_CONFIG_ETC for alternative etc directory
|
||||
-show-api Print META-INFO api value and exit
|
||||
-show-patch Print META-INFO patch value and exit
|
||||
-with-api=NUM Specify alternative api value to search with
|
||||
@ -118,15 +119,6 @@ optMode=ugo # Default search = 'ugo'
|
||||
# Environment overrides
|
||||
case "$FOAM_CONFIG_MODE" in ([ugo]*) optMode="$FOAM_CONFIG_MODE" ;; esac
|
||||
|
||||
# Verify validity of FOAM_CONFIG_ETC
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ ! -d "$FOAM_CONFIG_ETC" ] || [ "$FOAM_CONFIG_ETC" = "$projectDir/etc" ]
|
||||
then
|
||||
# Bad directory or redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@ -211,6 +203,10 @@ do
|
||||
optSilent=true
|
||||
;;
|
||||
|
||||
-etc=*)
|
||||
# FOAM_CONFIG_ETC for finding files. Empty unsets it (later)
|
||||
export FOAM_CONFIG_ETC="${1#*=}"
|
||||
;;
|
||||
-prefix=* | -version=*)
|
||||
echo "ignored defunct option '${1%%=*}'" 1>&2
|
||||
;;
|
||||
@ -237,6 +233,23 @@ done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Verify FOAM_CONFIG_ETC
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ "$FOAM_CONFIG_ETC" = "etc" ] \
|
||||
|| [ "$FOAM_CONFIG_ETC" = "$projectDir/etc" ]
|
||||
then
|
||||
# Redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
elif [ "${FOAM_CONFIG_ETC#/}" = "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
# Relative to project-dir
|
||||
FOAM_CONFIG_ETC="$projectDir/$FOAM_CONFIG_ETC"
|
||||
fi
|
||||
else
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
|
||||
# Establish the API value
|
||||
[ -n "$projectApi" ] || projectApi=$(getApiInfo api)
|
||||
|
||||
|
@ -71,7 +71,7 @@ Options
|
||||
-help-full Display full help and exit
|
||||
|
||||
Basic
|
||||
-etc=DIR set FOAM_CONFIG_ETC for alternative project files
|
||||
-etc=[DIR] set/unset FOAM_CONFIG_ETC for alternative project files
|
||||
-project-path DIR specify 'WM_PROJECT_DIR' (eg, /opt/openfoam1806-patch1)
|
||||
-version VER specify project version (eg, v1806)
|
||||
-sp | -SP | -float32 single precision (WM_PRECISION_OPTION)
|
||||
@ -416,8 +416,9 @@ CONFIG_CSH
|
||||
## Basic ##
|
||||
|
||||
-etc=*)
|
||||
# Define FOAM_CONFIG_ETC for finding files
|
||||
# FOAM_CONFIG_ETC for finding files. Empty unsets it
|
||||
export FOAM_CONFIG_ETC="${1#*=}"
|
||||
[ -n "$FOAM_CONFIG_ETC" ] || unset FOAM_CONFIG_ETC
|
||||
;;
|
||||
|
||||
-project-path)
|
||||
|
@ -127,12 +127,10 @@ while ( $#argv > 0 )
|
||||
shift
|
||||
end
|
||||
|
||||
# The prefs may have injected a FOAM_CONFIG_ETC value.
|
||||
# Verify that it makes sense before continuing.
|
||||
# Verify FOAM_CONFIG_ETC (from calling environment or from prefs)
|
||||
if ( $?FOAM_CONFIG_ETC ) then
|
||||
if ( ! -d "$FOAM_CONFIG_ETC" ) then
|
||||
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC"
|
||||
else if ( "$FOAM_CONFIG_ETC" == "$WM_PROJECT_DIR/etc" ) then
|
||||
if ( "$FOAM_CONFIG_ETC" == "etc" || "$FOAM_CONFIG_ETC" == "$WM_PROJECT_DIR/etc" ) then
|
||||
# Redundant value
|
||||
unsetenv FOAM_CONFIG_ETC
|
||||
endif
|
||||
endif
|
||||
|
@ -115,19 +115,19 @@ else
|
||||
_foamEval "$@"
|
||||
fi
|
||||
|
||||
# The prefs may have injected a FOAM_CONFIG_ETC value.
|
||||
# Verify that it makes sense before continuing.
|
||||
# Verify FOAM_CONFIG_ETC (from calling environment or from prefs)
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ ! -d "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC" 1>&2
|
||||
unset FOAM_CONFIG_ETC
|
||||
elif [ "$FOAM_CONFIG_ETC" = "$WM_PROJECT_DIR/etc" ]
|
||||
if [ "$FOAM_CONFIG_ETC" = "etc" ] \
|
||||
|| [ "$FOAM_CONFIG_ETC" = "$WM_PROJECT_DIR/etc" ]
|
||||
then
|
||||
# Redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
else
|
||||
export FOAM_CONFIG_ETC
|
||||
fi
|
||||
else
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user