Skip to content

Commit

Permalink
Add quotes around paths passed to graphviz (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
chtenb committed Jan 20, 2024
1 parent ed40b89 commit 2d62877
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Rubjerg.Graphviz.Test/Reproductions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
Expand All @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion Rubjerg.Graphviz/GraphvizCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 2d62877

Please sign in to comment.