Hello,

I did some work on this problem I have with command line arguments:

>>>> 3)
>>>> One remaining problem is that command line arguments are
>>>> automatically escaped via " if they contain spaces. Now it is
>>>> possible that a to be compiled booklet has a space in it so the
>>>>   appropriate command line would look like this: helpstudio2.exe
>>>> /bk="just a test" projectfile.hsp Unfortunately, when I pass the
>>>> option as /bk=just a test it gets converted to "/bk=just a test"
>>>> or /bk="just a test" gets converted to '/bk="just a test"' and
>>>> HelpStudio doesn´t recognize these. 
>>> 
>>> Who is escaping? Or is it just inside the debug log?
> 
> Hello to the wacky world of command line args in windows.
> There are four levels of processing.
> 1) WIN32:CreateProcess this take in one string as a command line and
>    splits into an executable and a list of command line arguments. -
>    so it needs to handle " and ' to allow directories with spaces to
>    be seen as one arg.
> 2)  java.lang.ProcessImpl this "normalizes" an array of arguments
into
>     a single string, if an argument contains a space, the argument
is
> quoted with
>     a " (unless it is already "quoted").
> 3) org.apache.tools.ant.types.CommandLine.quoteArgument() - this is
>     only called on <arg line="a b c"/>, I think
> 4) the executable itself (or the C wrapper - in cygwin land).


Now, my task constructs the correct escaped String and when I use this
on the windows command line it works without problems. However, when I
use this...

   private static final String HS_CMD_LINE = "helpstudio2.exe";
   [...]
   cmd.setExecutable(path + HS_CMD_LINE);
   cmd.addArguments((String[]) lArgs.toArray(new
String[lArgs.size()]));


   Output of cmd.toString():
      C:\Programme\Innovasys\HelpStudio2\bin\helpstudio2.exe /s
/bk="te st" "C:\1temp\helpstudioant\te st\test.hsp"

...HelpStudio throws an exception. This probably means, that /bk="te
st" was converted to '/bk="te st"' so HelpStudio thinks that the
project file is used twice.

I´m in contact with Innovasys to see if they can change the way
command line arguments are used in HelpStudio. Though, I would like to
know if there is a way to solve this problem by myself or if there is
no such way.

Any suggestions are welcome =)


Lars


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to