*/
public static boolean buildJavaHelp(String outputDirectory, String language) {
Indexer indexer = new Indexer();
-
+ String outputJavaHelp = new String (outputDirectory + JAVAHELPSEARCH_DIR);
try {
+ Helpers.deleteDirectory(outputJavaHelp); /* Purge the directory before launching the index because the JavaHelp Indexer failed when launched twice on the same directory */
String[] args = new String[] {
"-db",
- outputDirectory + JAVAHELPSEARCH_DIR, /* Where the Java Help Index should be created */
+ outputJavaHelp, /* Where the Java Help Index should be created */
outputDirectory
};
indexer.compile(args);
// -----------------------------------------------------------------------
+ /**
+ * Delete a directory and all his content
+ *
+ * @param dir The path to the directory
+ */
+ public static void deleteDirectory(String dir) {
+ deleteDirectory(new File(dir));
+ }
+
+ /**
+ * Delete a directory and all his content
+ *
+ * @param dir The file object of the path to the directory
+ */
+ public static void deleteDirectory(File dir) {
+
+ String files[] = dir.list();
+ if (files == null) {
+ files = new String[0];
+ }
+ for (int i = 0; i < files.length; i++) {
+ File file = new File(dir, files[i]);
+ if (file.isDirectory()) {
+ Helpers.deleteDirectory(file);
+ } else {
+ file.delete();
+ }
+ }
+ dir.delete();
+
+ }
+
+ // -----------------------------------------------------------------------
+
public static String[] split(String string, char separatorChar) {
// Count elements ---