$ show WinMerge/winmerge
WinMerge is an open-source differencing and merging tool for Windows, written in C++ with MFC and ATL. It provides file and folder comparison (2- and 3-way), syntax highlighting, inline editing, patch generation, and archive support. The application is structured as a monolith with a plugin system (COM-based DLLs) for pre-diff filtering, unpacking, and transformation. It integrates tightly with Windows Explorer via a shell extension and supports internationalization, dark mode, and extensive customization through property pages. The architecture follows the MFC document/view pattern, with core diff engines (vendored xdiff and GNU diffutils), a filter engine with regex-based line/folder filtering, and an options manager using registry or INI file backends. Third-party dependencies are heavily vendored, including Boost (MPL, Fusion, Preprocessor), Poco (Foundation, XML, Encodings), tree-sitter, CrystalEdit, and libxdiff. The project is actively maintained with regular releases, a comprehensive manual, and automated CI/CD pipelines. While primarily a Windows desktop application, it showcases reusable patterns such as an extensible options management system, a self-contained byte comparison engine, a lightweight async task wrapper, and a property page host. However, the codebase carries significant legacy MFC idioms and platform-specific code, limiting cross-platform portability. The vendored dependency tree is large, and some preprocessor-heavy Boost headers are fragile with compiler updates.
The LLM identified 4 files worth highlighting for reuse:
Defines an abstract COptionsMgr interface for reading/writing options with string keys. Concrete implementations CRegOptionsMgr (Windows registry) and CIniOptionsMgr (INI file) demonstrate the strategy pattern. The interface is self-contained, with no dependencies beyond standard library types (CString, bool, int). It can be extracted and reused in any C++ application needing a simple key-value configuration store, and the pattern allows easy addition of new backends.
Provides a collection of static functions for common path operations: checking existence, normalization, URL/UNC handling, shortcut expansion, and comparing paths. The functions are standalone and rely only on Windows API and CString. This module can be extracted into a new project to provide consistent path handling, especially for applications dealing with file system operations across directories and archives.
Implements a simple asynchronous task execution utility using _beginthreadex and a critical section. Provides a CreateTask function that accepts a std::function<void()> and returns a handle. The implementation is self-contained (no Boost, no Poco) and can be reused in any Windows C++ project that needs a minimal thread pool or fire-and-forget task execution without introducing heavyweight threading libraries.
Defines a ByteComparator class that performs byte-level file comparison with configurable ignore options (e.g., ignoreCase, ignoreWhitespace, ignoreEOL). The engine reads file content and returns a DIFFCODE status. It is self-contained, using only standard file I/O and memory buffers. This component can be extracted and reused in any application needing a fast, configurable binary compare function, independent of the rest of the WinMerge GUI.