Skip to content

Commit 2d62877

Browse files
authored
Add quotes around paths passed to graphviz (#73)
1 parent ed40b89 commit 2d62877

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Rubjerg.Graphviz.Test/Reproductions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using NUnit.Framework;
2+
using System;
23
using System.Globalization;
34
using System.IO;
45
using System.Linq;
@@ -20,6 +21,15 @@ public void SetUp()
2021
_testDir = TestContext.CurrentContext.TestDirectory;
2122
}
2223

24+
[Test()]
25+
public void ExportPathWithSpaces()
26+
{
27+
RootGraph root = RootGraph.CreateNew(GraphType.Directed, "");
28+
_ = root.GetOrAddNode("A");
29+
root.ToDotFile(TestContext.CurrentContext.TestDirectory + "/name with spaces.dot");
30+
root.ToSvgFile(TestContext.CurrentContext.TestDirectory + "/name with spaces.svg");
31+
}
32+
2333
[Test()]
2434
[TestCase("Times-Roman", 7, 0.01)]
2535
[TestCase("Times-Roman", 7, 0.5)]

Rubjerg.Graphviz/GraphvizCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static (byte[] stdout, string stderr) Exec(Graph input, string format = "
4242
string arguments = $"-T{format} -K{engine}";
4343
if (outputPath != null)
4444
{
45-
arguments = $"{arguments} -o{outputPath}";
45+
arguments = $"{arguments} -o\"{outputPath}\"";
4646
}
4747
string inputToStdin = input.ToDotString();
4848

0 commit comments

Comments
 (0)