argv[0] needs to be an absolute path

Dan Kegel dank at kegel.com
Wed Jan 1 21:58:56 CST 2003


The C program

main(int argc, char **argv) { puts(argv[0]); }

outputs an absolute path on Windows, but sometimes
outputs a relative path on Wine.  This causes the
commandline
   $ wine d:setup
to fail to find its files properly if it uses the
basename of argv[0].  One example of this is msvc4.0
(although it only tries this if an earlier method fails,
so there's another bug lurking).

I am about to submit a one-line patch to fix this to
wine-patches.  (If I weren't a wimp, I'd figure out
a way to submit a regression test, too, although
it'd be a strange one; most of our tests don't need
to invoke Wine itself from the Unix commandline!)

The same problem exists for programs launched from other
wine programs, e.g. from inside wcmd.
That's another code path, and I couldn't find a
one-line fix for that one.
- Dan

-- 
Dan Kegel
Linux User #78045
http://www.kegel.com




More information about the wine-devel mailing list