You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Diane Holt <ho...@yahoo.com> on 2000/09/20 10:10:57 UTC

[PATCH] task should verify specified dir

The <java> task should check to make sure the directory specified in the
dir attribute exists, and do the nice thing if it doesn't, instead of just
letting java throw an io exception on CreateProcess (which doesn't tell
java neophytes such as myself a whole lot about what could be wrong). 
Changing the following lines appears to work (but maybe there's a better
way/place to do it [I've also attached a patch-file I hope is in the right
format to be usable]):
113c113,120
<             return run(cmdl.getCommandline());
---
>           if (dir != null) {
>             if ( ! dir.isDirectory() ) {
>                 throw new BuildException(dir + " is not a directory.") ;
>             }
>           }
>
>           return run(cmdl.getCommandline());

Specifying a bogus directory then produces:

Buildfile: build.xml
sysinfo:

BUILD FAILED

build.xml:843: D:\dianeh\src\main\foo is not a directory.

Total time: 1 seconds

Diane


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/