public static String addCommand ( List < String > cmd , boolean isExecutable ) throws IOException { StringBuffer command = new StringBuffer ( ) ; for ( String s : cmd ) { command . append ( ' ' ) ; if ( isExecutable ) { // the executable name needs to be expressed as a shell path for the // shell to find it. command . append ( FileUtil . makeShellPath ( new File ( s ) ) ) ; isExecutable = false ; } else { command . append ( s ) ; } command . append ( ' ' ) ; command . append ( " " ) ; } return command . toString ( ) ; }
Add quotes to each of the command strings and return as a single string