Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#202 CommandLineCompiler should allow for java added quotes

open
nobody
None
5
2007-04-30
2007-04-30
Tom Quarendon
No

The code in CommandLineCompiler.compile that attempts to calculate how many source files it can compile in one go withoug blowing the maximum command line length doesn't allow for the fact that the java code that launches the process can add quotes around an argument if if contains spaces and is not already surrounded in quotes.
I had a compile task that the CommandLineCompiler.compile method calculated was 32765 characters long, cut one of the arguments specifying an include directory contained a space, so java added quotes around it when cnverting from the array of Strings to the single string to pass to CreateProcess. This took the line length to 32767 which windows then complained at.

A sufficient fix for my purposes was to change the bit that's calculating the length of the base arguments to

for (int i = 0; i < args.length; i++) {
baseLength += args[i].length();
if (args[i].indexOf(' ')!=-1) baseLength += 2; // allow for quotes surrounding value.
}

However I admit that that may be a windows specific fix (maybe java on other platforms deals with spaces in the arguments in other ways)

Discussion