Click here to Skip to main content
13,287,856 members (52,951 online)
Click here to Skip to main content
Add your own
alternative version


16 bookmarked
Posted 24 Jan 2005

WinFiltDiff, a utility to filter out unimportant source-differences

, 27 Jan 2005
Rate this:
Please Sign up or sign in to vote.
A utility to filter out unimportant source-differences.


WinFiltDiff 1.1 is a tool that allows you to filter the input to WinDiff so WinDiff does not clutter its output with files you do not care about. You can use WinFiltDiff to suppress WinDiff entries about intermediate files like .obj files. It can suppress differences due to varying expansions of Visual Source Safe (VSS) keywords, so the likes of:

$Archive: /RunWinFiltDiff/DirComparer.h $
$Author: Chris.forden $
$Date: 12/29/04 7:48p $

have no effect on the apparent differences in files. You can also exclude compiler-generated files that contain fixed compiler-generated messages in their first lines. These features allow you to exclude all the COM-generated headers and intermediate files from comparisons, if you choose.

WinFiltDiff accomplishes this by copying only files with significant differences to output directories in a location you can choose -- typically a temp directory. Then WinFiltDiff runs WinDiff on those copied files. This effectively filters the input to WinDiff.

You can also choose a directory that contains .txt files that describe the rules WinFiltDiff uses to exclude files. You can edit those rules with a text editor and create alternative exclusion-rule directories which you can conveniently choose from within a drop-down combo box in WinFiltDiff's GUI.

Since only files with differences get copied to the directories that WinDiff checks, WinDiff cannot reveal missing files. Therefore, WinFiltDiff generates a list of missing files in its output directory.

I re-used Chris Maunder's RunWinDiff GUI code to create WinFiltDiff.

I grant permission to use my modifications as you wish, as long as you give me credit by listing my name and contribution. To use this code, you must accept all responsibility for errors and omissions; since we provide it for free, we cannot test it thoroughly.

Usage Details

You will need to keep the "ignore blanks" option on in WinDiff in order to ignore $keyword: expansions $ because WinFiltDiff appends blanks to the ends of files in order to make them have the same size when it copies them to its output directories.

Wild cards (e.g.: "*") have no non-literal effect in the exclusion files.

WinFiltDiff never deletes its temporary output, so you will have to eventually delete them manually. However, it might be convenient to keep the output around for a little while; typically, the output directories only hold recently changed source files, so the total disk-usage is minimal. WinFiltDiff creates a subdirectory called \Diff\ in the temporary or other output directory you choose in the GUI. When you run WinFiltDiff again, it moves its previous output (\Diff\*.*) into a numbered subdirectory inside \Diff Prev\.

GUI changes from RunWinDiff

I made the directory/file chooser combo boxes much wider because we now have wider (hi-res) screens and; now we can see the full path-name, even if it is long. I added an icon for the app, so it can be chosen from the task-bar or Alt-tab. I made the Choose Folder icon look like a folder; although the "..." icon is standard, I thought a distinction between choosing files and choosing folders would be helpful. I added some color to the file/directory choosing combo boxes to indicate the color that WinDiff would associate them with.

Future Possibilities

Allowing the user to choose other visual comparison tools besides WinDiff would be desirable. Creating a file in the exclusions directory that would allow the user to exclude whole directories (e.g., "\Debug\") would save runtime and eliminate empty folders that WinFiltDiff now creates in the temp directory. I was planning to have a file, "Exclusions\AnywhereInPathName.txt", that would do that. I abstracted the functionality in the hierarchy of WinFiltDiff classes beginning with "CList..." so additional .txt files with exclusion rules could be easily added.

It would be useful to be able to exclude files that had changes only in their comments. It would be useful to exclude files that only had changes in whitespace, including new-lines. WinDiff itself can exclude additions and deletions of extra tabs and blanks, but cannot ignore new-line characters.

Maybe a nice additional exclusion list would be pairs of new/old tokens such that files whose only changes were the substitution of one specified old token with its corresponding specified new token would also be excluded.

Maybe someday, I will add these capabilities. Don't hold your breath, though.

Bugs Fixed in 1.1 that plagued 1.0

The output directory often could not be created.

The "Now Checking" real-time display would sometimes show a double-slash in the path-name.

The Temp/Diff/Prev folder got an unlimited nesting as you ran WinFiltDiff. Eventually, that will cause the folder to be undeletable. Now the previous temp files are not placed in a hierarchy of prev folders, but a numbered list of them. If you have trouble deleting a Diff/Prev folder created by WinFiltDiff 1.0, you can open up the hierarchy to a dozen levels or so, then move the deepest one up. I did that a few times (and ran ChkDisk which did not seem to help) and then could finally delete all the Prev folders.

Bugs known to still plague 1.0

COM-generated .h files bearing the first line "this ALWAYS GENERATED file contains the definitions for the interfaces" sometimes are not excluded. This seems to occur if one of the files had been generated by VC++ 7.0 and the other by VC++ 6.0. I suspect the bug is due to Unicode in one file but not the other.

Sometimes, choosing a folder on a different volume can change not only the combo box you are selecting it into, but (if the other combo box has an entry chosen from other than the first entry on its list) also the other combo box. This bug has been inherited from the 1998 RunWinDiff GUI and its DropComboBox code reuse.

Adding additional blank lines to the end of the .txt files in the ExclusionLists folder causes everything to match (because any string can be considered to contain a null line).


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Chris Forden
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171207.1 | Last Updated 27 Jan 2005
Article Copyright 2005 by Chris Forden
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid