Browse Source

#3457: Fix incorrect handling of assemblyPath in MermaidDiagrammer/Generator.Run.cs

pull/3398/head
Siegfried Pammer 2 months ago
parent
commit
34a2c9e7d7
  1. 14
      ICSharpCode.ILSpyX/MermaidDiagrammer/Generator.Run.cs

14
ICSharpCode.ILSpyX/MermaidDiagrammer/Generator.Run.cs

@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer @@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer
{
public void Run()
{
var assemblyPath = GetPath(Assembly);
var assemblyPath = Assembly;
XmlDocumentationFormatter? xmlDocs = CreateXmlDocsFormatter(assemblyPath);
ClassDiagrammer model = BuildModel(assemblyPath, xmlDocs);
GenerateOutput(assemblyPath, model);
@ -39,7 +39,7 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer @@ -39,7 +39,7 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer
protected virtual XmlDocumentationFormatter? CreateXmlDocsFormatter(string assemblyPath)
{
var xmlDocsPath = XmlDocs == null ? Path.ChangeExtension(assemblyPath, ".xml") : GetPath(XmlDocs);
var xmlDocsPath = XmlDocs == null ? Path.ChangeExtension(assemblyPath, ".xml") : XmlDocs;
XmlDocumentationFormatter? xmlDocs = null;
if (File.Exists(xmlDocsPath))
@ -132,15 +132,5 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer @@ -132,15 +132,5 @@ namespace ICSharpCode.ILSpyX.MermaidDiagrammer
File.WriteAllText(Path.Combine(outputFolder, "excluded types.txt"), excludedTypes);
}
}
private protected virtual string GetPath(string pathOrUri)
{
// convert file:// style argument, see https://stackoverflow.com/a/38245329
if (!Uri.TryCreate(pathOrUri, UriKind.RelativeOrAbsolute, out Uri? uri))
throw new ArgumentException("'{0}' is not a valid URI", pathOrUri);
// support absolute paths as well as file:// URIs and interpret relative path as relative to the current directory
return uri.IsAbsoluteUri ? uri.AbsolutePath : pathOrUri;
}
}
}
Loading…
Cancel
Save