b62da609cf70688466da60372a361df5488c75e6
mspeir
  Thu Jan 5 10:40:21 2017 -0800
Adding check to see if user-supplied directory exists before accepting it. Also adding command that checks to see of there is a hubFiles directory in the supplied directory and creates it if it doesn't exist. refs #18603 #18316

diff --git src/utils/qa/getPubHubContact.sh src/utils/qa/getPubHubContact.sh
index a07fbff..460e78a 100755
--- src/utils/qa/getPubHubContact.sh
+++ src/utils/qa/getPubHubContact.sh
@@ -28,40 +28,50 @@
 """
 
 runScript=""
 base=""
 
 # Print usage statement
 if (( $# < 1 )) || (( $# > 2 ))
 then
 	echo -e $usage
 	exit 1
 elif (( $# == 1 ))
 then
 	runScript=$1
 elif (( $# == 2 ))
 then
+	# Check if outputLocation exists
+	if [[ -d $2 ]]
+	then
 		runScript="$1"
 		base="$2"
+	else
+		echo -e "Sorry, directory \"$2\" does not exist. Check spelling or create this directory and try again.\n"
+		exit 1
+	fi
 fi
 
 # If no user provided base location, then assume it's being run on dev and output to default loc.
 if [[ "$base" == "" ]]
 then
 	base="/usr/local/apache/htdocs-genecats/qa/test-results/publicHubContactInfo"
 fi
 
+# Create "hubFiles" directory in base if it doesn't exist
+mkdir -p $base/hubFiles
+
 if [[ "$runScript" == "go" ]]
 then
 	contactFile="$base/publicHubContact.html"
 	# Check if old contact file exists and if it does move it to archive file
 	if [ -e $contactFile ]
 	then
 		mv $contactFile $contactFile.old
 	fi
 
 	# Make header for html file
 	echo -e "
 	<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
 		\"http://www.w3.org/TR/html4/loose.dtd\">
 	" >> $contactFile