diff options
author | Mikaël Barbero | 2014-01-22 18:45:04 +0000 |
---|---|---|
committer | Mikaël Barbero | 2014-01-22 19:06:27 +0000 |
commit | 1a9a5420f3eed2404bf2bc400d1558e1cce01780 (patch) | |
tree | bd802f5b0350d2f40e7f241ffcf4a09dc74410cd /packaging | |
parent | d1a652543f75ab9ccf47b84a56b6766b19865b54 (diff) | |
download | org.eclipse.emf.compare-1a9a5420f3eed2404bf2bc400d1558e1cce01780.tar.gz org.eclipse.emf.compare-1a9a5420f3eed2404bf2bc400d1558e1cce01780.tar.xz org.eclipse.emf.compare-1a9a5420f3eed2404bf2bc400d1558e1cce01780.zip |
Get ride of the need of the PLACEHOLDER file in the help folder
Change-Id: Id69fc22a95c1dca96f23a2edcf1f0028aefa38ce
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java index 4988ec181..2ae3a973b 100644 --- a/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java +++ b/packaging/org.eclipse.emf.compare.gendoc/src/org/eclipse/emf/compare/doc/WikiTextToHTML.java @@ -165,8 +165,13 @@ public class WikiTextToHTML { targetWebsiteFolder = DEFAULT_FS.getPath("target", "website").resolve(gitDescribe());
targetHelpFolder = DEFAULT_FS.getPath("help");
+ final Path resolvedTargetHelpFolder = targetRootFolder.resolve(targetHelpFolder);
if (genEclipseHelp) {
+ if (Files.exists(resolvedTargetHelpFolder)) {
+ System.out.println("Deleting "+ resolvedTargetHelpFolder + " before regenerating Eclipse help");
+ removeRecursiveContent(resolvedTargetHelpFolder);
+ }
primaryTOCWriter.startPrimaryTOC(targetHelpFolder.resolve("index.html"), "EMF Compare Documentation");
}
@@ -219,7 +224,7 @@ public class WikiTextToHTML { if (genEclipseHelp) {
primaryTOCWriter.endPrimaryTOC();
- writeStringToFile(primaryTOCWriter.getPrimaryTOCContent(), targetRootFolder.resolve(targetHelpFolder).resolve("toc.xml"));
+ writeStringToFile(primaryTOCWriter.getPrimaryTOCContent(), resolvedTargetHelpFolder.resolve("toc.xml"));
writeStringToFile(primaryTOCWriter.getPluginContent(), targetRootFolder.resolve("plugin.xml"));
}
@@ -227,7 +232,7 @@ public class WikiTextToHTML { if (genWebsite)
copy(folder, targetRootFolder.resolve(targetWebsiteFolder).resolve(folder.getFileName()), "glob:**/*");
if (genEclipseHelp)
- copy(folder, targetRootFolder.resolve(targetHelpFolder).resolve(folder.getFileName()), "glob:**/*");
+ copy(folder, resolvedTargetHelpFolder.resolve(folder.getFileName()), "glob:**/*");
}
}
@@ -351,6 +356,40 @@ public class WikiTextToHTML { file.getParent().toFile().mkdirs();
}
}
+
+ private static void removeRecursiveContent(final Path path) throws IOException {
+ Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc)
+ throws IOException {
+ // try to delete the file anyway, even if its attributes
+ // could not be read, since delete-only access is
+ // theoretically possible
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc)
+ throws IOException {
+ if (exc == null) {
+ if (!dir.equals(path)) {
+ Files.delete(dir);
+ }
+ return FileVisitResult.CONTINUE;
+ } else {
+ // directory iteration failed; propagate exception
+ throw exc;
+ }
+ }
+ });
+ }
private Path changeFilename(Path source, String newFileExtension) {
return changeFilename(source, "", newFileExtension);
|