[Wine] Re: Winepath on Mac

doh123 wineforum-user at winehq.org
Fri Apr 16 01:05:27 CDT 2010


yes... was just a quick thought without some testing and debugging... its still going to suffer from the same problem without the single quotes that way.... but that makes it not work right when passing in a variable... cuz it takes the $ literally.

I'm guessing your wanting to pass it a variable....

if you want to pass a variable to it...  try this...


Code:
#!/bin/bash
THESTRING="$@"
THESTRING="${THESTRING//\\/\\\\}"
TEMPVAR="$(/usr/local/bin/winepath "$THESTRING")"
echo "${TEMPVAR#${TEMPVAR%:*}:}"



same thing basically, but it switches out all the single \  in the path its passing to be escaped as \\ before calling winepath with it.

you still have to use single quotes around the string if you type it in manually... such as
winepathOSX 'Z:\Applications\Firefly\BENCH1.out'

but this way if you pass it a variable and have it work right...
TEST='Z:\Applications\Firefly\BENCH1.out'
winepathOSX $TEST
will display
/Applications/Firefly/BENCH1.out


If your variable is getting set and really contains "Z:\Applications\Firefly\BENCH1.out" exactly as seen and passed in with a variable, the extra lines I added above should take care of it.

Winepath in wine is actually functioning correctly.  The problem is the command line itself... when you type
winepath Z:\Applications\Firefly\BENCH1.out
it is not sending the string as you see it to winepath, winepath is getting the wrong information.... there is nothing winepath can do to change that.... you have to single quote it, or escape all the reserved characters.  
you can see this if you type...
TEST=Z:\Applications\Firefly\BENCH1.out
with no quotes like that.. then see what actually got read...
echo $TEST
and it will NOT be what your wanting it to be, because the \ is not read literally, its a reserved character.
TEST=Z:\\Applications\\Firefly\\BENCH1.out
this would work though, as a \ is telling it the next character is a literal character to take, so \\ would become a single \ in the string.
the extra 2 lines I added above is basically turning all the \ in the string to \\ so when its passed to winepath, its correct.







More information about the wine-users mailing list