Sorry, code fragment is:
ExecTask exec = createExec();
if (vbBinaryDir != null)
{
try
{
Environment.Variable var = new Environment.Variable();
var.setKey("path");
var.setValue(vbBinaryDir.getCanonicalPath());
exec.addEnv(var);
}
catch (IOException e)
{
throw new BuildException();
}
}
...
<corrected typo>
d.
-----Original Message-----
From: David McTavish [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 3:44 PM
To: 'Ant Users List'
Subject: 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(vbBinaryDir.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.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]