Add modern default search paths for GNU Diff on Windows.
Review Request #12945 — Created April 11, 2023 and submitted — Latest diff uploaded
Windows is the only modern OS that lacks any kind of a built-in diff
tool, making usage on Windows less convenient when working with SCMs
that don't provide their own native diff tool.
We've historically recommended a particular installer for GNU Diff on
Windows, but it's very old, and it's long past time we move away from
it. While there's no standalone replacement available from a
third-party, we have a few options.
Git for Windows includes a version of GNU Diff that can be run, though
it's not in the Git path unless running a Git-specific shell. Unity for
Windows also bundles a copy of GNU Diff. These are now explicitly in the
We're also going to be supplying our own copy with the RBTools for
Windows installer, which will be the first one we'll check.
The old legacy GnuWin32 version is still supported as a fallback, if
available. We now search the path directly, rather than requiring the
user to include it in the system search path.
And finally, for all platforms, we now accept
gdiffas a GNU Diff
candidate, not just on SunOS. This is useful for macOS, BSD, and
Unit tests pass.
Ran this on Windows, with the code tweaked to check all candidates
even after a match, and verified the results for all paths, depending
on what I had installed.