From b7b323ced5921b9898a2be7e4d524dbcfd230ec4 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Fri, 24 Nov 2006 20:08:28 +0000 Subject: [PATCH] Handle pathnames with embedded spaces. --- doc/faq.xml | 12 ++++++++++++ doc/ver.xml | 1 + src/gr/spinellis/umlgraph/doclet/UmlGraphDoc.java | 15 +++++++++++---- src/org/umlgraph/doclet/UmlGraphDoc.java | 15 +++++++++++---- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/doc/faq.xml b/doc/faq.xml index e226066..1512b03 100644 --- a/doc/faq.xml +++ b/doc/faq.xml @@ -10,6 +10,7 @@ To update the table of contents execute the following vim command from a registe

Contents

+

What is the command line sequence to generate a UMLGraph class diagram?

+Assuming that you diagram's description is in the file Diag.java, +issue the commands: + +javadoc -docletpath absolute-path-to/UmlGraph.jar -doclet gr.spinellis.umlgraph.doclet.UmlGraph -output Diag.dot Diag.java +dot -Tpng -oDiag.png Diag.dot + +In the above you can change png to another file format, +and add more UMLGraph switches before the -option switch. + +

Why are the SVG diagrams dot generates malformed?

UMLGraph uses guillemot characters for representing the angle brackets around stereotypes, as in «interface». diff --git a/doc/ver.xml b/doc/ver.xml index 3639ce2..9ac123a 100644 --- a/doc/ver.xml +++ b/doc/ver.xml @@ -8,6 +8,7 @@
  • Correct running of the UmlGraphDoc tests
  • Correct the JavaDoc generation (Maxim Butov)
  • Correct appearance of generic names (Ivan F. Villanueva B.)
  • +
  • UmlGraphDoc now handles filenames with embedded spaces (Jörn Guy Süß)
  • diff --git a/src/gr/spinellis/umlgraph/doclet/UmlGraphDoc.java b/src/gr/spinellis/umlgraph/doclet/UmlGraphDoc.java index 53ec158..9cbc6f6 100644 --- a/src/gr/spinellis/umlgraph/doclet/UmlGraphDoc.java +++ b/src/gr/spinellis/umlgraph/doclet/UmlGraphDoc.java @@ -44,9 +44,9 @@ public class UmlGraphDoc { * @return */ public static boolean start(RootDoc root) { - root.printNotice("UmlDoc version " + Version.VERSION + ", running the standard doclet"); + root.printNotice("UmlGraphDoc version " + Version.VERSION + ", running the standard doclet"); Standard.start(root); - root.printNotice("UmlDoc version " + Version.VERSION + ", altering javadocs"); + root.printNotice("UmlGraphDoc version " + Version.VERSION + ", altering javadocs"); try { String outputFolder = findOutputPath(root.options()); @@ -128,8 +128,15 @@ public class UmlGraphDoc { File mapFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".map"); try { - String command = "dot -Tcmapx -o" + mapFile.getAbsolutePath() + " -Tpng -o" - + pngFile.getAbsolutePath() + " " + dotFile.getAbsolutePath(); + /* + * Put filenames inside double quote characters to allow + * (typically Windows) files with embedded whitespace to + * work. This will still fail with Unix ` and $ characters, + * but it is better than nothing. + */ + String command = "dot -Tcmapx -o\"" + mapFile.getAbsolutePath() + "\" -Tpng -o\"" + + pngFile.getAbsolutePath() + "\" \"" + + dotFile.getAbsolutePath() + "\""; Process p = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream())); String line = null; diff --git a/src/org/umlgraph/doclet/UmlGraphDoc.java b/src/org/umlgraph/doclet/UmlGraphDoc.java index 53ec158..9cbc6f6 100644 --- a/src/org/umlgraph/doclet/UmlGraphDoc.java +++ b/src/org/umlgraph/doclet/UmlGraphDoc.java @@ -44,9 +44,9 @@ public class UmlGraphDoc { * @return */ public static boolean start(RootDoc root) { - root.printNotice("UmlDoc version " + Version.VERSION + ", running the standard doclet"); + root.printNotice("UmlGraphDoc version " + Version.VERSION + ", running the standard doclet"); Standard.start(root); - root.printNotice("UmlDoc version " + Version.VERSION + ", altering javadocs"); + root.printNotice("UmlGraphDoc version " + Version.VERSION + ", altering javadocs"); try { String outputFolder = findOutputPath(root.options()); @@ -128,8 +128,15 @@ public class UmlGraphDoc { File mapFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".map"); try { - String command = "dot -Tcmapx -o" + mapFile.getAbsolutePath() + " -Tpng -o" - + pngFile.getAbsolutePath() + " " + dotFile.getAbsolutePath(); + /* + * Put filenames inside double quote characters to allow + * (typically Windows) files with embedded whitespace to + * work. This will still fail with Unix ` and $ characters, + * but it is better than nothing. + */ + String command = "dot -Tcmapx -o\"" + mapFile.getAbsolutePath() + "\" -Tpng -o\"" + + pngFile.getAbsolutePath() + "\" \"" + + dotFile.getAbsolutePath() + "\""; Process p = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream())); String line = null;