I have a Windows diff tool that's simply better than any Linux diff tool I've found (and I've done some pretty extensive analysis on visual diff tools). I want to use that tool on Linux (via Wine) and be able to pass Linux file paths to it, in part because two-pane file managers like Double Commander automatically pass the full file paths when calling the diff tool.
So I'm asking the reverse of this question: How can I convert the Linux-style file paths, including escaping characters such as spaces, to Windows-style file paths that would be accepted by a Windows tool ran via Wine?
For a simplistic example,
Input:
/path/to/file1.ext /path/to/file2.ext
Output
"\path\to\file1.ext" "\path\to\file2.ext"
Of course, in the real world, files can have spaces and whatnot, so I'm looking for a solution more reliable than the bash
substitution I have so far:
#!/bin/bash
p1=$1
p2=$2
wine /utils/wincmp.exe ${p1//\//\\} ${p2//\//\\}
/
in place of\
just fine; are you sure it doesn't work already if that's all you're doing to them? – Michael Homer Dec 28 '17 at 07:02/
is the option introducer character and it supports a whole bunch of options such as/n
and/r
. Part of the problem here is I suspect the Win32 tool not supporting anything like the Unix--
convention, thus having no way to stop it from thinking that POSIX-style paths are command options. (I have always made sure that my OS/2, DOS, and Win32 tools allow either-
as the option character or have a//
mechanism. Not everyone does, though.) – JdeBP Dec 28 '17 at 07:55