ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Monsees" <l.mons...@atlantisgmbh.de>
Subject RE: HelpStudioAnt (was: "AW: failure notice")
Date Tue, 24 Oct 2006 15:15:32 GMT
(snip)

>>>> 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


I use it in this way:

   lArgs.add(HS_OPT_BOOKLET + booklet);

   // Create command-line
   Commandline cmd = new Commandline();
   cmd.setExecutable(path + HS_CMD_LINE);
   cmd.addArguments((String[]) lArgs.toArray(new
String[lArgs.size()]));

   // Create Execute object from command-line
   Execute exe = new Execute(new LogStreamHandler(this,
Project.MSG_INFO,
            Project.MSG_WARN));
   exe.setAntRun(getProject());
   exe.setWorkingDirectory(getProject().getBaseDir());
   exe.setCommandline(cmd.getCommandline());



>>>> 5)
>>>> Most of the variables are declared as protected because this is
>>>> what I´ve seen in nsisant. Is this preferred over private
>>>> variables? 
>>> 
>>> Not sure about an Ant philosophy here, but protected variables
>>> support subclassing ...
> 
> Mmm, Ant "philosophy" is to have *ALL* variables as private.

changed



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message