Skip to content

Commit

Permalink
Merge pull request #37 from romanb52/meldDiff
Browse files Browse the repository at this point in the history
Added Meld diff application as a diff program
  • Loading branch information
droyad authored Nov 1, 2022
2 parents 74a83e2 + 3992e5f commit f71c499
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 f71c499

Please sign in to comment.