fixed an issue for copying directories

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@979977 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2010-07-28 08:07:12 +00:00
parent 5e0e4248de
commit cca20b81d7
1 changed files with 9 additions and 10 deletions

View File

@ -156,20 +156,19 @@ public final class IOHelper {
copyFile(src,dest,null);
}
public static void copyFile(File src, File dest,FilenameFilter filter) throws IOException {
public static void copyFile(File src, File dest, FilenameFilter filter) throws IOException {
if (src.getCanonicalPath().equals(dest.getCanonicalPath()) == false) {
if (src.isDirectory()) {
if (dest.isDirectory()) {
mkdirs(dest);
List<File> list = getFiles(src,filter);
for (File f : list) {
if (f.isFile()) {
File target = new File(getCopyParent(src, dest, f), f.getName());
copySingleFile(f, target);
}
}
mkdirs(dest);
List<File> list = getFiles(src, filter);
for (File f : list) {
if (f.isFile()) {
File target = new File(getCopyParent(src, dest, f), f.getName());
copySingleFile(f, target);
}
}
} else if (dest.isDirectory()) {
mkdirs(dest);
File target = new File(dest, src.getName());