Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-02-25 14:28:19 +0000
committerSteffen Pingel2012-02-25 14:28:19 +0000
commit20ba1201c9d5a6fe53743a66e01d1f1ffa21fd4c (patch)
treee63751d9ace32a7e3f5f505f3d7ff1f032d4dade
parent3910a9fb5ac20c523859ca17ef8aac80d6c17245 (diff)
downloadorg.eclipse.mylyn.commons-20ba1201c9d5a6fe53743a66e01d1f1ffa21fd4c.tar.gz
org.eclipse.mylyn.commons-20ba1201c9d5a6fe53743a66e01d1f1ffa21fd4c.tar.xz
org.eclipse.mylyn.commons-20ba1201c9d5a6fe53743a66e01d1f1ffa21fd4c.zip
NEW - bug 358554: [api] provide an extensible store for task-related
information https://bugs.eclipse.org/bugs/show_bug.cgi?id=358554 * Fix test by copying directories recursively
-rw-r--r--org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
index bb52cc00..d0b4f326 100644
--- a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
+++ b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
@@ -93,25 +93,30 @@ public class CommonTestUtil {
* Copies all files in the current data directory to the specified folder. Will overwrite.
*/
public static void copyFolder(File sourceFolder, File targetFolder) throws IOException {
- for (File currFile : sourceFolder.listFiles()) {
- if (currFile.isFile()) {
- File destFile = new File(targetFolder, currFile.getName());
- copy(currFile, destFile);
- } else if (currFile.isDirectory()) {
- File destDir = new File(targetFolder, currFile.getName());
+ for (File sourceFile : sourceFolder.listFiles()) {
+ if (sourceFile.isFile()) {
+ File destFile = new File(targetFolder, sourceFile.getName());
+ copy(sourceFile, destFile);
+ }
+ }
+ }
+
+ /**
+ * Copies all files in the current data directory to the specified folder. Will overwrite.
+ */
+ public static void copyFolderRecursively(File sourceFolder, File targetFolder) throws IOException {
+ for (File sourceFile : sourceFolder.listFiles()) {
+ if (sourceFile.isFile()) {
+ File destFile = new File(targetFolder, sourceFile.getName());
+ copy(sourceFile, destFile);
+ } else if (sourceFile.isDirectory()) {
+ File destDir = new File(targetFolder, sourceFile.getName());
if (!destDir.exists()) {
if (!destDir.mkdir()) {
- throw new IOException("Unable to create destination context folder: "
- + destDir.getAbsolutePath());
- }
- }
- for (File file : currFile.listFiles()) {
- File destFile = new File(destDir, file.getName());
- if (destFile.exists()) {
- destFile.delete();
+ throw new IOException("Unable to create destination folder: " + destDir.getAbsolutePath());
}
- copy(file, destFile);
}
+ copyFolderRecursively(sourceFile, destDir);
}
}
}

Back to the top