Index: /issm/trunk-jpl/etc/environment.sh
===================================================================
--- /issm/trunk-jpl/etc/environment.sh	(revision 26091)
+++ /issm/trunk-jpl/etc/environment.sh	(revision 26092)
@@ -1,3 +1,3 @@
-# Modifies path-related envrionment variables based on which external packages
+# Modifies path-related environment variables based on which external packages
 # have been installed.
 #
@@ -184,11 +184,10 @@
 #######################
 
-OS=$(uname -s)
-
-if [[ "${OS}" == MINGW* ]]; then
+MINGW=0
+if [[ $(uname -s) == MINGW* ]]; then
+	MINGW=1
 	MSMPI_ROOT="${ISSM_EXT_DIR}/msmpi/install"
 	if [ -d "${MSMPI_ROOT}" ]; then
 		export MSMPI_ROOT # Used in installation of ParMETIS, ScaLAPACK
-		path_prepend "${ISSM_DIR}/bin" # Allows dynamic loaded to find DLLs
 		cpath_prepend "${MSMPI_ROOT}/include"
 		library_path_prepend "${MSMPI_ROOT}/lib"
@@ -293,5 +292,5 @@
 	ld_library_path_append "${BLAS_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${BLAS_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -304,5 +303,5 @@
 	ld_library_path_append "${LAPACK_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${LAPACK_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -315,5 +314,5 @@
 	ld_library_path_prepend "${METIS_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${METIS_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -325,5 +324,5 @@
 	library_path_append "${MUMPS_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${MUMPS_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -336,5 +335,5 @@
 	ld_library_path_prepend "${PARMETIS_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${PARMETIS_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -346,5 +345,5 @@
 	library_path_append "${SCALAPACK_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${SCALAPACK_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -363,5 +362,5 @@
 	ld_library_path_prepend "${PETSC_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${PETSC_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
@@ -541,5 +540,5 @@
 	dyld_library_path_append "${TRIANGLE_ROOT}/lib"
 
-	if [[ "${OS}" == MINGW* ]]; then
+	if [[ ${MINGW} -eq 1 ]]; then
 		path_append "${TRIANGLE_ROOT}/lib" # Allows dynamic loaded to find DLLs
 	fi
Index: /issm/trunk-jpl/jenkins/jenkins.sh
===================================================================
--- /issm/trunk-jpl/jenkins/jenkins.sh	(revision 26091)
+++ /issm/trunk-jpl/jenkins/jenkins.sh	(revision 26092)
@@ -219,5 +219,5 @@
 fi
 
-# Source here to include any newly installed externalpackages on the path.
+# Source here to include any newly-installed external packages on the path
 source ${ISSM_DIR}/etc/environment.sh
 
@@ -227,5 +227,6 @@
 fi
 
-# Set CXX/CC flags for JS runs after exnteralpackages to avoid conflicts during their compilation
+# Set CXX/CC flags for JS runs after external packages to avoid conflicts 
+# during their compilation
 #
 # TODO:
@@ -235,4 +236,5 @@
 # - Revisit enviroment variables (especially EMCC_CFLAGS) once support for
 #	Fortran has been accomplished.
+#
 CXX_PREVIOUS=$CXX
 CC_PREVIOUS=$CC
@@ -311,4 +313,12 @@
 # {{{
 if [ $MATLAB_TEST -eq 1 ]; then
+	MINGW=0
+	if [[ $(uname -s) == MINGW* ]]; then
+		MINGW=1
+		if [ -z "${ISSM_DIR_WIN}+x" ]; then
+			export ISSM_DIR_WIN=$(cygpath -w "${ISSM_DIR}")
+		fi
+	fi
+
 	#Launch all tests on different cpus
 	for (( i=1;i<=$NUMCPUS_RUN;i++ )); do
@@ -335,5 +345,5 @@
 EOF
 		cd $ISSM_DIR/test/NightlyRun
-		if [[ "${OS}" == CYGWIN* || "${OS}" == MINGW* ]]; then
+		if [[ "${OS}" == CYGWIN* || ${MINGW} -eq 1 ]]; then
 			$MATLAB_PATH/bin/matlab -nodesktop -nosplash -nojvm -r "addpath ${ISSM_DIR_WIN}/src/m/dev; devpath; addpath ${ISSM_DIR_WIN}/nightlylog; matlab_run$i" -logfile ${ISSM_DIR_WIN}/nightlylog/matlab_log$i.log &
 		else
@@ -343,4 +353,8 @@
 
 	# Wait for MATLAB to exit
+	#
+	# TODO:
+	# - Replace by adding -wait option to above calls to matlab?
+	#
 	if [[ "${OS}" == CYGWIN* ]]; then
 		sleep 5;
