diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..2fc7381 --- /dev/null +++ b/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/.project b/.project new file mode 100644 index 0000000..2673c68 --- /dev/null +++ b/.project @@ -0,0 +1,42 @@ + + + haflow + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..3b2886e --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..45a6e0e --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..4ed4633 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..cc81385 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..25ce01e --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/src/main/java/haflow/utility/ClassHelper.java b/src/main/java/haflow/utility/ClassHelper.java index 4ee9163..6ae48e0 100644 --- a/src/main/java/haflow/utility/ClassHelper.java +++ b/src/main/java/haflow/utility/ClassHelper.java @@ -25,7 +25,7 @@ public class ClassHelper { for (URL url : urls) { if (url.getProtocol().equals("file")) { File file = new File(url.getFile()); - String root = file.getPath(); + String root = file.getPath().replace("\\", "/"); if (file.isDirectory()) { classNames.addAll(this.getClassNamesFromDirectory(root, packageName, searchInChildPackage, file, true)); @@ -48,10 +48,11 @@ public class ClassHelper { List classNames = new ArrayList(); File[] files = directory.listFiles(); for (File file : files) { + String filePath = file.getPath().replace("\\", "/"); if (file.isDirectory()) { if (searchInChildPackage || continueSearch) { boolean needToContinue = continueSearch; - if (file.getPath().endsWith(packageName.replace(".", "/"))) { + if (filePath.endsWith(packageName.replace(".", "/"))) { needToContinue = needToContinue & false; } classNames.addAll(this.getClassNamesFromDirectory(root, @@ -59,9 +60,8 @@ public class ClassHelper { needToContinue)); } } else { - if (file.getPath().endsWith(".class")) { - String classFileName = file.getPath().replace(root + "/", - ""); + if (filePath.endsWith(".class")) { + String classFileName = filePath.replace(root + "/", ""); if (classFileName.startsWith(packageName.replace(".", "/"))) { String className = classFileName.substring(0, classFileName.length() - ".class".length()) diff --git a/src/test/java/haflow/test/ClassHelperTest.java b/src/test/java/haflow/test/ClassHelperTest.java index 02c2bd5..dfa374c 100644 --- a/src/test/java/haflow/test/ClassHelperTest.java +++ b/src/test/java/haflow/test/ClassHelperTest.java @@ -10,7 +10,7 @@ public class ClassHelperTest { @Test public void test() { ClassHelper classHelper = new ClassHelper(); - List classes = classHelper.getClassNames("hmoudle", true); + List classes = classHelper.getClassNames("haflow", true); if (classes != null) { for (String c : classes) { System.out.println(c);