Quantcast
Viewing all articles
Browse latest Browse all 3

Convert file path from Linux to Windows format for Wine tool

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//\//\\}

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>