Skip to content

Commit b9d034e

Browse files
Improve invokation of Unix utilities when running within Wine
1 parent 0ca3aa8 commit b9d034e

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

util/invoke-unix-wine.exe

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
command=$1
55
shift
66

7-
"$command" $@
8-
7+
$(winepath --unix "$command") $@
8+
exit $?

util/invoke-unix.bat

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@ REM This batch file forwards commands to a Unix-like shell
44
REM
55
REM We need to work around what looks to be a MCVS bug: the final parameter is
66
REM missing the terminating '"' when quoted
7+
SET commands=%*"
8+
9+
@echo Invoking Unix command '%commands%'
10+
11+
REM Does this look like a wine environment?
12+
REM We guess this by looking for a common-ish Wine env var
13+
IF DEFINED WINEDEBUG (
14+
START /wait %~dp0\invoke-unix-wine.exe %commands%
15+
EXIT %ERRORLEVEL%
16+
)
717

8-
@echo Invoking Unix command '%*"'
918

1019
IF EXIST C:\Cygwin\bin (
1120
REM Obscure way to get the cmd.exe equivalent to `...` substitution
1221
FOR /F "usebackq tokens=*" %%x IN (`C:\Cygwin\bin\cygpath.exe %CD%`) DO SET cygwin_cd=%%x
1322
FOR /F "usebackq tokens=*" %%x IN (`C:\Cygwin\bin\cygpath.exe %*"`) DO SET cygwin_cmd=!cygwin_cmd! %%x
1423

1524
C:\Cygwin\bin\bash.exe -c 'cd !cygwin_cd! ^&^& !cygwin_cmd!'
16-
) ELSE (
17-
invoke-unix-wine.exe %*"
25+
EXIT %ERRORLEVEL%
1826
)
1927

20-
EXIT %ERRORLEVEL%
28+
@echo Could not find Cygwin or wine
29+
EXIT 1
2130

0 commit comments

Comments
 (0)