ASF Bugzilla – Attachment 11246 Details for
Bug 28403
Floating attribute for import task
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Example implementation
ant.diff (text/plain), 2.96 KB, created by
johan.vromans
on 2004-04-15 08:15:50 UTC
(
hide
)
Description:
Example implementation
Filename:
MIME Type:
Creator:
johan.vromans
Created:
2004-04-15 08:15:50 UTC
Size:
2.96 KB
patch
obsolete
>*** apache-ant-1.6.1/src/main/org/apache/tools/ant/taskdefs/ImportTask.java Thu Feb 12 14:33:24 2004 >--- BuildProcess/ImportFloat.java Thu Apr 15 09:26:20 2004 >*************** >*** 60,65 **** >--- 60,66 ---- > public class ImportTask extends Task { > private String file; > private boolean optional; >+ private boolean find = false; > private static final FileUtils FILE_UTILS = FileUtils.newFileUtils(); > > /** >*************** >*** 73,78 **** >--- 74,90 ---- > } > > /** >+ * sets the float attribute >+ * >+ * @param float if true, traverses the directory hierarchy upwards >+ * to locate the actual file to import. >+ * Default is false. >+ */ >+ public void setFloat(boolean find) { >+ this.find = true; >+ } >+ >+ /** > * the name of the file to import. How relative paths are resolved is still > * in flux: use absolute paths for safety. > * @param file the name of the file >*************** >*** 120,126 **** > // *not* the current directory (same as entity includes). > > File buildFileParent = new File(buildFile.getParent()); >! File importedFile = FILE_UTILS.resolveFile(buildFileParent, file); > > if (!importedFile.exists()) { > String message = >--- 132,163 ---- > // *not* the current directory (same as entity includes). > > File buildFileParent = new File(buildFile.getParent()); >! File importedFile = null; >! >! /* Search for the import file towards the root of the file >! * system (like the --find command line option for build >! * files). >! * Note that is you specify foo/bar.xml, the search will be for >! * foo/bar.xml, ../foo/bar.xml, ../../foo/bar.xml, and so on. >! * This makes it possible to import files from a higher level >! * sibling directory. >! */ >! >! File findFile = new File(file); >! if ( find && !findFile.isAbsolute() ) { >! File parent = buildFileParent; >! while ( parent != null ) { >! findFile = new File(parent, file); >! if ( findFile.exists() ) { >! importedFile = findFile; >! break; >! } >! parent = parent.getParentFile(); >! } >! } >! >! if ( importedFile == null ) >! importedFile = FILE_UTILS.resolveFile(buildFileParent, file); > > if (!importedFile.exists()) { > String message = >*** apache-ant-1.6.1/docs/manual/CoreTasks/import.html Thu Feb 12 14:33:14 2004 >--- BuildProcess/ant-manual-import.html Thu Apr 15 09:16:58 2004 >*************** >*** 93,98 **** >--- 93,108 ---- > </td> > <td valign="top" align="center">No</td> > </tr> >+ <tr> >+ <td valign="top">float<br> >+ </td> >+ <td valign="top"> >+ if true, locate the file to be imported by traversing the file >+ system towards the root. >+ Default is false.<br> >+ </td> >+ <td valign="top" align="center">No</td> >+ </tr> > </tbody> > </table> > <h3><br>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 28403
: 11246