Skip to content

Commit

Permalink
Fix for #78 (#79)
Browse files Browse the repository at this point in the history
Prevent null error when the library is used in self-contained apps
  • Loading branch information
modery authored Feb 7, 2024
1 parent 1f1cda8 commit 654b362
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Rubjerg.Graphviz/GraphvizCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public static (byte[] stdout, string stderr) Exec(Graph input, string format = "
// Get the location of the currently executing DLL
// https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.codebase?view=net-5.0
string exeDirectory = AppDomain.CurrentDomain.RelativeSearchPath
?? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
?? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
?? Path.GetDirectoryName(System.AppContext.BaseDirectory);

// Construct the path to the executable
string exePath = Path.Combine(exeDirectory, exeName);
Expand Down

0 comments on commit 654b362

Please sign in to comment.