Double quotes don't work correctly in the Unix exec

(reported by Dirk Datzert)
Run exec(String []), which I tested to work on both Windows and Unix.
This commit is contained in:
Diomidis Spinellis 2007-02-05 09:22:16 +00:00
parent 19d2716782
commit 84a3c98d16
2 changed files with 20 additions and 20 deletions

View File

@ -128,16 +128,16 @@ public class UmlGraphDoc {
File mapFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".map");
try {
/*
* 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);
Process p = Runtime.getRuntime().exec(new String [] {
"dot",
"-Tcmapx",
"-o",
mapFile.getAbsolutePath(),
"-Tpng",
"-o",
pngFile.getAbsolutePath(),
dotFile.getAbsolutePath()
});
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String line = null;
while((line = reader.readLine()) != null)

View File

@ -128,16 +128,16 @@ public class UmlGraphDoc {
File mapFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".map");
try {
/*
* 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);
Process p = Runtime.getRuntime().exec(new String [] {
"dot",
"-Tcmapx",
"-o",
mapFile.getAbsolutePath(),
"-Tpng",
"-o",
pngFile.getAbsolutePath(),
dotFile.getAbsolutePath()
});
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String line = null;
while((line = reader.readLine()) != null)