1

In a previous post, I only see pure Linux paths and pure Windows paths are used when running a Windows executable under wine.

When is a wine-based Linux path such as /home/t/.wine/dosdevices/z:/tmp/test/O.pdfused?

winepath converts a pure Linux path to a wine-based Linux path. For example,

$ echo "$(winepath /tmp/test/O.pdf)"
/home/t/.wine/dosdevices/z:/tmp/test/O.pdf

When is the output of winepath used?

Thanks.

1 Answer 1

2

Digging into winepath, there's different configuration options for it.

With regards to another related question you asked which I answered, you can use winepath to find the Windows-compatible path for a given Linux path direction.

However, the winepath is only really useful with specific arguments passed, as the different arguments it accepts actually tell it what you are looking for.

winepath accepts a bunch of useful arguments, of which -u and -w are most useful here. This is from the winepath manpage from the 3.4 development version of Wine:

OPTIONS
       -u, --unix
              converts a Windows path to a Unix path.

       -w, --windows
              converts a Unix path to a long Windows path.

With these in mind, we can get /tmp/test/0.pdf into a useful Windows path. (I'm using /tmp/blah.txt in my example though)

Convert a Unix path to a long Windows path - what you had to do in your other question - which then is something you can pass to a Windows executable, and is based on your winecfg drive mapping (it takes a few minutes to run):

$ winepath -w /tmp/blah.txt
Z:\tmp\blah.txt

Convert a Windows long path to a Unix filepath - the inverse of what you needed to do, but what is actually useful if you have something installed in the Wine C:\ drive and need to the Linux file path to the file/executable/folder/etc. This helps you if you need to edit something in a path that you're not aware of where it sits on disk, namely usually in ~/.wine/drive_c and such because there's a lot of things you might need direct folder access for. For your example, below, it's not real useful, since we know already intrinsically that Z: is mapped to / on your system. However, you can technically access the file via the full Wine Linux path below (which works, because ~/.wine/dosdevices/z: is actually just a symlink for / in your setup, and mine):

$ winepath -u 'Z:\tmp\test\0.pdf'
/home/teward/.wine/dosdevices/z:/tmp/test/0.pdf

This seems to be the 'default' - it takes a Windows path and outputs the Linux equivalent for the Windows file path with regards to the existing Wine installation.


So, TL;DR:

Your primary use cases, therefore, are:

  • To take a Unix filesystem path and get the Windows-style path with regards to the Drive setup in your Wine Prefix; this is what you would have to enter to get the answer in the other question you posted. (since you can't use Unix paths in Windows executables' arguments, or in an Open dialog in a Wine-opened executable, since those need Windows style paths)

  • To take a Wine-based Windows path and get the corresponding Linux filesystem path so you can interact with the file in the standard Linux system directly (since you can't use Windows paths in Unix to interact with the files in the Ubuntu operating system directly)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .