Attached is a patch to Magic.java modifies the handling of the
resolution of the index.xml file. If no index is declared - the handler
will recursively look in parent directories for an index.xml until
either an index (or if nothing found - the normal exception process
kicks in).
Cheers, Steve.
Index: Magic.java
===================================================================
--- Magic.java (revision 45919)
+++ Magic.java (working copy)
@@ -289,6 +289,11 @@
}
else
{
+ //
+ // seach from here progressively looking in the parent directory
+ // until we find an index
+ //
+
return resolve( basedir );
}
}
@@ -299,7 +304,26 @@
{
if( index.isDirectory() )
{
- return resolve( new File( index, "index.xml" ) );
+ File file = new File( index, "index.xml" );
+ if( file.exists() )
+ {
+ return file;
+ }
+ else
+ {
+ File parent = index.getParentFile();
+ if( null != parent )
+ {
+ try
+ {
+ return resolve( parent );
+ }
+ catch( Throwable e )
+ {
+ // ignore
+ }
+ }
+ }
}
else
{
@@ -308,10 +332,26 @@
}
else
{
- final FileNotFoundException e =
- new FileNotFoundException( index.toString() );
- throw new BuildException( e );
+ if( index.isDirectory() )
+ {
+ File parent = index.getParentFile();
+ if( null != parent )
+ {
+ try
+ {
+ return resolve( parent );
+ }
+ catch( Throwable e )
+ {
+ // ignore
+ }
+ }
+ }
}
+
+ final FileNotFoundException fnfe =
+ new FileNotFoundException( index.toString() );
+ throw new BuildException( fnfe );
}
private static String getTemplatePath( File system )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]