wine's argv[0] and current directory

Vitaliy Margolen wine-devel at
Sat Jul 21 11:05:52 CDT 2007

Damjan Jovanovic wrote:
> Hi
> We have 2 problems in wine:
> 1. When you run "wine /path/to/app.exe", argv[0] is "/path/to/app.exe"
> which is definitely wrong. The most serious consequence of this is
> that apps run through file browser double-clicking can break.
> 2. Whether you run "wine D:\setup.exe" or "wine
> /media/cdrom/setup.exe", the current directory is never "D:\" and when
> you double-click an .exe the current directory is $HOME so it's always
> wrong. You can't "cd /media/cdrom && wine setup.exe" either because
> that stops ejecting the CD for multi-CD installs.
> Can we kill 2 birds with 1 stone here and do something like
> if (argv[0] is a unix path)
> {
>    make argv[0] a windows path
>    SetCurrentDirectory(directory of argv[0]);
> }
> before starting the app? Since Windows never uses UNIX paths this
> can't break any Windows app, and it will fix double-click startups and
> multiple CD installs.

First of all there are extensive tests for this in kernel32 process test. 
Which shows exactly opposite from what you stated here - windows does 
support use of unix path.

Second, your approach will brake lots of new programs that can not be 
started from their directory. They can only be started from _outside_ 
directory they are in with 'start app.exe'.


More information about the wine-devel mailing list