ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Martin <jeff.mar...@synamic.co.uk>
Subject [Patch] Copydir, flattening directory structures
Date Wed, 02 Aug 2000 09:28:01 GMT
This is something I've had to do for the project I'm working on. It allows
you to specifiy a flatten attribute which makes Copydir ignore the directory
structure for the destination files and copy them all in to the one
directory.

It's probably not really a sensible thing to be doing (Duplicated file
names) but if you need to do it this works.

Index: src/main/org/apache/tools/ant/taskdefs/Copydir.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.j
ava,v
retrieving revision 1.10
diff -b -B -r1.10 Copydir.java
73a74
>     private boolean flatten = false;
91a93,96
>     public void setFlatten(String flatten) {
>         this.flatten = Project.toBoolean(flatten);
>     }
> 
130c135,140
<             File destFile = new File(to, filename);
---
>             File destFile;
>             if(flatten){
>                 destFile = new File(to, new File(filename).getName());
>             }else{
>                 destFile = new File(to, filename);
>             }

Mime
View raw message