Skip to content

Commit

Permalink
Added Meld diff application as a diff program
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Belonohy committed Nov 1, 2022
1 parent 74a83e2 commit 3992e5f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
34 changes: 34 additions & 0 deletions src/Assent/Reporters/DiffPrograms/MeldDiffProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.Linq;

namespace Assent.Reporters.DiffPrograms;

public class MeldDiffProgram : DiffProgramBase
{
static readonly IReadOnlyList<string> DefaultSearchPaths;

static MeldDiffProgram()
{
var paths = new List<string>();
if (DiffReporter.IsWindows)
{
paths.AddRange(WindowsProgramFilePaths
.Select(p => $@"{p}\Meld\Meld.exe")
.ToArray());
}
else
{
paths.Add("/usr/bin/meld");
paths.Add("/usr/local/bin/meld");
paths.Add("/snap/bin/meld");
paths.Add("/opt/homebrew/bin/meld");
}
DefaultSearchPaths = paths;
}

public MeldDiffProgram()
: base(DefaultSearchPaths) { }

protected override string CreateProcessStartArgs(string receivedFile, string approvedFile) => "\"" + receivedFile + "\" \"" + approvedFile + "\"";
}

6 changes: 4 additions & 2 deletions src/Assent/Reporters/DiffReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ static DiffReporter()
new KDiff3DiffProgram(),
new XdiffDiffProgram(),
new P4MergeDiffProgram(),
new VsCodeDiffProgram()
new VsCodeDiffProgram(),
new MeldDiffProgram()
}
: new IDiffProgram[]
{
new EnvironmentVariableDiffProgram(),
new BeyondCompareDiffProgram(),
new VsCodeDiffProgram()
new VsCodeDiffProgram(),
new MeldDiffProgram()
};

}
Expand Down

0 comments on commit 3992e5f

Please sign in to comment.