diff --git a/config/makeConfigAppInclude.pl b/config/makeConfigAppInclude.pl
index a1ee0750120802972c3c2bd6d66ae198af92c318..f1f947e083c3fda8e10486fff2202dbe2471752a 100644
--- a/config/makeConfigAppInclude.pl
+++ b/config/makeConfigAppInclude.pl
@@ -70,6 +70,8 @@ foreach $file (@files) {
 		    $post = $base . $post;
 		}
 	    }
+	    
+	    $prefix =~ s/^\s+|\s+$//g; # strip leading and trailing whitespace.
 	    $applications{$prefix} = $post;
 	    if ( -d "$post") { #check that directory exists
 		print OUT "\n";
diff --git a/config/makeIocCdCommands.pl b/config/makeIocCdCommands.pl
index 87e103595ccfcb22f1af92e3f112cfc6b7f058a0..8637e4786e9127391772083aebc830aa9d6394c8 100644
--- a/config/makeIocCdCommands.pl
+++ b/config/makeIocCdCommands.pl
@@ -72,6 +72,8 @@ foreach $file (@files) {
 			$post = $base . $post;
 		    }
 		}
+		
+		$prefix =~ s/^\s+|\s+$//g; # strip leading and trailing whitespace.
 		$applications{$prefix} = $post;
 		$app = lc($prefix);
 		if ( -d "$post") { #check that directory exists