diff --git a/Rubjerg.Graphviz.Test/Reproductions.cs b/Rubjerg.Graphviz.Test/Reproductions.cs index c755eb5..eb1b355 100644 --- a/Rubjerg.Graphviz.Test/Reproductions.cs +++ b/Rubjerg.Graphviz.Test/Reproductions.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using System; using System.Globalization; using System.IO; using System.Linq; @@ -20,6 +21,15 @@ public void SetUp() _testDir = TestContext.CurrentContext.TestDirectory; } + [Test()] + public void ExportPathWithSpaces() + { + RootGraph root = RootGraph.CreateNew(GraphType.Directed, ""); + _ = root.GetOrAddNode("A"); + root.ToDotFile(TestContext.CurrentContext.TestDirectory + "/name with spaces.dot"); + root.ToSvgFile(TestContext.CurrentContext.TestDirectory + "/name with spaces.svg"); + } + [Test()] [TestCase("Times-Roman", 7, 0.01)] [TestCase("Times-Roman", 7, 0.5)] diff --git a/Rubjerg.Graphviz/GraphvizCommand.cs b/Rubjerg.Graphviz/GraphvizCommand.cs index 8cec2a4..3744f70 100644 --- a/Rubjerg.Graphviz/GraphvizCommand.cs +++ b/Rubjerg.Graphviz/GraphvizCommand.cs @@ -42,7 +42,7 @@ public static (byte[] stdout, string stderr) Exec(Graph input, string format = " string arguments = $"-T{format} -K{engine}"; if (outputPath != null) { - arguments = $"{arguments} -o{outputPath}"; + arguments = $"{arguments} -o\"{outputPath}\""; } string inputToStdin = input.ToDotString();