WinMerge returns "1" upon closing, if files read-only
Windows visual diff and merge for files and directories
Brought to you by:
christianlist,
grimmdp
WinMerge returns "1" (instead of "0" = "OK") upon closing, if files compared were read-only. (Files were not modified - just compared.)
The issue does not occure if the cursor was not placed in the file text body (either manually or by going through differences).
I do not see any reason why WinMerge should return anything but "successful" on file comparison. The exception should only be technical problems, but none of the user actions that the user is aware of (e.g. purposly not saving changes, etc.).
Logged In: YES
user_id=631874
Originator: NO
Thanks for reporting this. It is not actually about files being read-only. WinMerge simply tries to return compare status.
This "feature" was added in back for selftests or some such and unfortunately nobody really thought about it.
I'll fix this for next stable release to return 0 unless there is an error.
Logged In: YES
user_id=631874
Originator: NO
I'll fix this bug with this simple patch which makes WinMerge always to return 0.
So the approach I'll take is start with always returning zero. And add possible error returns when we really need those. At the moment I don't know situation where we must return something other than 0. Some merge scripts etc probably would want return value if the merge succeeded, but that is not easy as user can open another files or folders and close original files so we don't even know which file's return value we should return (ones given from command-line? last opened?...)
Index: Merge.cpp
--- Merge.cpp (revision 4956)
+++ Merge.cpp (working copy)
@@ -447,7 +447,7 @@
charsets_cleanup();
delete m_mainThreadScripts;
CWinApp::ExitInstance();
- return m_nLastCompareResult;
+ return 0;
}
static void AddEnglishResourceHook()
Logged In: YES
user_id=631874
Originator: NO
Committed to SVN trunk:
Completed: At revision: 4970
Closing as fixed.