You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David McTavish <dm...@SANDVINE.com> on 2003/02/06 21:43:39 UTC
trying to write custom task wrapping Exec
Just wondering how I can update the path for the ExecTask. I've borrowed
code from the optional Cab task, but I wish to update the path used by the
Execute object. Here is what I currently have:
ExecTask exec = createExec();
if (vbBinaryDir != null)
{
try
{
Environment.Variable var = new Environment.Variable();
var.setKey("path");
var.setValue(binaryDir.getCanonicalPath());
exec.addEnv(var);
}
catch (IOException e)
{
throw new BuildException();
}
}
...
For some reason, by setting the binaryDir (configured as a File and set in
the ant build script with binaryDir="path/to/file.exe"), it is not finding
the file appropriately, but the path is correct.
(I test this by rewriting this as an exec task, and pass in the path with
the env/key= parameter as follows:
<exec executable="${bin.vb}" dir="${vb.projectdir}">
<env key="path" path="${lib.sw-tools}/vb/bin"/>
<arg line="/m ${vb.projectfile} /out
${vb.projectdir}/compile.log"/>
</exec>
Is there an easy way to convert a File object into a org.ant...Path object?
And is this, where I am going wrong?
(And is there an official Visual Basic compiler task, which would make me
writing this task overkill?)
Thanks,
d.