Handle pathnames with embedded spaces.

This commit is contained in:
Diomidis Spinellis 2006-11-24 20:08:28 +00:00
parent 421785ef7d
commit b7b323ced5
4 changed files with 35 additions and 8 deletions

View File

@ -10,6 +10,7 @@ To update the table of contents execute the following vim command from a registe
<h2>Contents</h2>
<ul>
<li> <a href="#cmdline">What is the command line sequence to generate a UMLGraph class diagram?</a></li>
<li> <a href="#utfsvg">Why are the SVG diagrams dot generates malformed?</a></li>
<li> <a href="#antialias">How can I improve the quality of the bitmap images I generate?</a></li>
<li> <a href="#layout">How can I improve the layout of my class diagrams?</a></li>
@ -25,6 +26,17 @@ To update the table of contents execute the following vim command from a registe
<li> <a href="#cpp">Can I create UML class diagrams from C++ code?</a></li>
</ul>
<h2><a name="cmdline">What is the command line sequence to generate a UMLGraph class diagram?</a></h2>
Assuming that you diagram's description is in the file Diag.java,
issue the commands:
<fmtcode ext="sh">
javadoc -docletpath absolute-path-to/UmlGraph.jar -doclet gr.spinellis.umlgraph.doclet.UmlGraph -output Diag.dot Diag.java
dot -Tpng -oDiag.png Diag.dot
</fmtcode>
In the above you can change <code>png</code> to another file format,
and add more UMLGraph switches before the <code>-option</code> switch.
<h2><a name="utfsvg">Why are the SVG diagrams dot generates malformed?</a></h2>
UMLGraph uses guillemot characters for representing the angle brackets around
stereotypes, as in «interface».

View File

@ -8,6 +8,7 @@
<li>Correct running of the UmlGraphDoc tests</li>
<li>Correct the JavaDoc generation (Maxim Butov)</li>
<li>Correct appearance of generic names (Ivan F. Villanueva B.)</li>
<li>UmlGraphDoc now handles filenames with embedded spaces (J&ouml;rn Guy S&uuml;&szlig;)</li>
</ul>
</dd>

View File

@ -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;

View File

@ -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;