I'm finding that the semantics of ExecTask are very confusing.
Tonight, I was finishing up my build scripts to call my CppUnit tests
once they were complete. This required me to execute a specific .EXE in
a specific directory. I wanted to be able to write:
<exec program="Tests.exe" basedir="${tests-build}"/>
The tests-build property pointed to the directory that contains
Tests.exe. This didn't work.
Upon further inspection, I found that basedir was being ignored in
ExecTask.cs. After a bit of looking around, I changed the definition of
the ProgramFileName property from:
public override string ProgramFileName { get { return _program; } }
to:
public override string ProgramFileName {
get
{
if( null == _baseDirectory )
return _program;
else
return Path.GetFullPath( Path.Combine( BaseDirectory, _program )
);
}
}
After this change, things seem a lot better, and my builds now run the
way I want. This seems to be a reasonable implementation that takes into
consideration the basedir attribute. It also lets you run:
<exec program="cmd.exe"/>
correctly, as it does not try and prepend cmd.exe with a path if basedir
is not defined.
Does this sound like a reasonable patch to ExecTask.cs? Anyone want to
drop it in?
Cheers,
-John
http://www.iunknown.com
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers