Command line arguments does not work for Cygwin file pattern
Windows visual diff and merge for files and directories
Brought to you by:
christianlist,
grimmdp
The following fails on Cygwin:
winmergeu /c/aaa.txt /c/bbb.txt
Merging those two files on Winmerge by selecting them in file explorer works, of course.
Running the following:
winmergeu /c/aaa.txt ccc.txt
Opens Winmerge window with a ccc.txt in the 'Left' pane, and the 'Right' pane is empty.
Can you tell the WinMerge version number?
It's WinMerge 2.10.2.0
Ok, I'll look into this.
Ok, it needed simply replace of '/' with '\' in command line handler for paths.
The patch (also attached):
Index: Src/MergeCmdLineInfo.cpp
--- Src/MergeCmdLineInfo.cpp (revision 6170)
+++ Src/MergeCmdLineInfo.cpp (working copy)
@@ -207,11 +207,16 @@
{
String param;
bool flag;
+
while ((q = EatParam(q, param, &flag)) != 0)
{
if (!flag)
{
- // Not a flag
+ // Its not a flag so it is a path
+ // Convert paths given in Linux-style ('/' as separator) given from
+ // Cygwin to Windows style ('\' as separator)
+ string_replace(param, String(_T("/")), String(_T("\\")));
+
// If shortcut, expand it first
if (paths_IsShortcut(param.c_str()))
param = ExpandShortcut(param.c_str());
File Added: cygwin_paths.patch
The patch
Fix committed to SVN trunk:
Completed: At revision: 6175
I'll commit this fix also to 2.10 branch. So next WinMerge release(s) will have this bug fixed.
I've now committed the fix to 2.10 branch too:
Completed: At revision: 6179
So the next 2.10.4 stable release will have this bug fixed. I'm hoping 2.10.4 release happens in begin of January...
Thanks a lot for reporting this bug!
Doesn't work in 2.11.1.8, which is later than 2008-12-17...
Shouldn't it be fixed in this version?
Yes, 2.11.1.8 has the fix I made. And I tested it by opening few URLs from cygwin prompt. Can you give examples of paths that don't work, perhaps I overlooked something...
Reopening.
Ugh. I meant paths, not URLs...
A trivial example which doesn't work:
$ winmergeu /c/JavaRa.log /c/AUTOEXEC.BAT
This doesn't work either from Cygwin shell or CMD shell.
I've upgraded to 2.11.1.8 from 2.10.2.0, without restarting. Is that a possible cause (I can't restart any time soon to check)?
BTW, the following (wrong?) syntax does open these files, though:
$ winmergeu c:JavaRa.log C:AUTOEXEC.BAT
The correct syntax works:
$ winmergeu c:\JavaRa.log C:\AUTOEXEC.BAT
Thanks for the info.
Don't you need /cygdrive/ in beginning of the path? Eg. /cygdrive/c/JavaRa.log /cygdrive/c/AUTOEXEC.BAT
Hmm. WinMerge could add this 'cygdrive' prefix to the paths using / as path separator. But I'm not sure if that is good idea generally.
These "full" Cygwin paths work for me. I'm not even sure if /c/work -style paths are supported by Cygwin officially.
So closing this as fixed.