wine's argv[0] and current directory

Damjan Jovanovic damjan.jov at
Sat Jul 21 10:37:55 CDT 2007


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.

Any thoughts?
Damjan Jovanovic

More information about the wine-devel mailing list