--- GNUstep-reset.sh 2004-11-07 21:42:49.000000000 -0500 +++ GNUstep-reset.sh 2004-11-08 01:19:30.717795904 -0500 @@ -34,30 +34,43 @@ # GNUSTEP_NETWORK_ROOT and GNUSTEP_USER_ROOT are removed from the path # variable (yes, we are rather crude). All other paths are kept # unchanged. + function reset_path { # Declare local variables local original_path tmp_IFS temp_path dir gnustep_dir found - # NB: We need to use eval because we want to access a variable - # whose name is another variable! - original_path=$(eval echo \$$1) - tmp_IFS="$IFS" + if [ -z "$1" ]; then + echo "Warning: ${FUNCNAME} called without an argument." + echo "This is a bug." + fi + + if [ -z "$2" ]; then + echo "Warning: ${FUNCNAME} called without an argument." + echo "This is a bug (2)." + fi + + original_path=${!1} + tmp_IFS="${IFS}" IFS=: temp_path= + # Loop on the paths for dir in $original_path; do # For each of them, keep it only if it's not beginning with # a path in GNUSTEP_PATHLIST as prefix found=no; for gnustep_dir in $GNUSTEP_PATHLIST; do - if [ -n "$gnustep_dir" ]; then - case "$dir" in - $gnustep_dir*) found=yes; break;; + if [ -n "$gnustep_dir$2" ]; then + case "$dir/" in + $gnustep_dir$2*) + found=yes; + break;; *);; esac; fi; done; + if [ "$found" = "no" ]; then if [ -z "$temp_path" ]; then temp_path="$dir" @@ -80,12 +93,14 @@ fi } -reset_path CLASSPATH -reset_path GUILE_LOAD_PATH -reset_path LD_LIBRARY_PATH -reset_path DYLD_LIBRARY_PATH -reset_path DYLD_FRAMEWORK_PATH -reset_path PATH +reset_path CLASSPATH /Library/Libraries/Java +reset_path GUILE_LOAD_PATH /Library/Libraries/Guile +reset_path LD_LIBRARY_PATH /Library/Libraries +# ... uhmmm, these aren't in GNUstep.sh ? (11/8/04) +# (yes, they're on Darwin, I know...;-)) +#reset_path DYLD_LIBRARY_PATH +#reset_path DYLD_FRAMEWORK_PATH +reset_path PATH /Tools # Make sure we destroy the reset_path function after using it - we don't # want to pollute the environment with it.