wine's argv[0] and current directory

Damjan Jovanovic damjan.jov at gmail.com
Sat Jul 21 15:44:56 CDT 2007


On 7/21/07, Vitaliy Margolen <wine-devel at kievinfo.com> wrote:
> 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'.

If a double-click starts an app in Windows, it should do the same in
wine, and the semantics of a double-click on Windows seem to be "start
this app in the file browser's current directory".

Now if wine cannot tell a true unix path from a windows unix path,
then we either need a separate process to be called on a double-click
that can translate argv[0] and chdir() before exec()ing wine, or a
command-line switch/environment variable to tell wine it was started
by a double-click and it should translate argv[0] and
SetCurrentDirectory() appropriately.

> Vitaliy.
>

Damjan



More information about the wine-devel mailing list