Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified CoDepend/.codepend/snapshot
Binary file not shown.
11 changes: 10 additions & 1 deletion CoDepend/Domain/RendererBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public sealed record RenderEdge(
IReadOnlyList<RenderRelation> Relations
);



public sealed record RenderGraph(
IReadOnlyDictionary<RelativePath, RenderNode> Nodes,
IReadOnlyDictionary<RelativePath, IReadOnlyList<RelativePath>> ChildrenByParent,
Expand All @@ -49,6 +51,12 @@ public abstract class RendererBase
{
public abstract string FileExtension { get; }

private static string NormalizeExtension(string ext)
{
ext = ext.Trim();
return ext.StartsWith('.') ? ext : "." + ext;
}

protected abstract string Render(RenderGraph graph, View view, RenderOptions options);

public string RenderView(ProjectDependencyGraph graph, View view, RenderOptions options)
Expand Down Expand Up @@ -96,7 +104,8 @@ public async Task SaveViewToFileAsync(string content, View view, RenderOptions o
Directory.CreateDirectory(dir);

var diffString = diff ? "-diff" : "";
var filename = $"{options.BaseOptions.ProjectName}{diffString}-{view.ViewName}.{FileExtension}";
var normalizedExtension = NormalizeExtension(FileExtension);
var filename = $"{options.BaseOptions.ProjectName}{diffString}-{view.ViewName}{normalizedExtension}";
var path = Path.Combine(dir, filename);

await File.WriteAllTextAsync(path, content, ct);
Expand Down