ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David McTavish <dmctav...@SANDVINE.com>
Subject trying to write custom task wrapping Exec
Date Thu, 06 Feb 2003 20:43:39 GMT
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.

Mime
View raw message