Wine desktop integration: current directory of app launched
scott at open-vote.org
Sun Apr 8 13:39:17 CDT 2007
On Fri, 2007-04-06 at 23:01 -0700, Dan Kegel wrote:
> I *almost* have a great success story to report; the only thing
> keeping it from being a success story is the current directory
> chosen by Nautilus when double-clicking on .exe files.
> My wife hurt a finger trying to impersonate a Sampsonite Luggage gorilla,
> and had to go to a hand doctor. Along the way her hand got x-rayed,
> and the doctor handed her a cd-rom with the x-ray pictures on it.
> The disc has an autorun.inf on it that should start ViewSel.exe.
> I don't know if that's supposed to work with Wine and Nautilus, but
> probably doubleclicking on ViewSel.exe does the same thing.
> ViewSel.exe puts up two big buttons:
> low res (which launches a web browser on an html file),
> and high res (which launches a DICOM viewer).
> If you cd to the root of the cd-rom drive and run ViewSel, it works.
> If the current directory is anything else, it doesn't work.
> If you start the autorun app via Nautilus, those buttons don't work,
> so presumably it sets the current directory to something other than
> the root of the drive. To see, I created a wrapper shell script, ~/bin/mywine,
> pwd > /tmp/log
> and used "Start with" to launch ViewSel.exe with ~/bin/mywine.
> This showed that the current directory was $HOME.
> I had a look at the gnome code to see how it decided, but it was
> a bit hard to follow. (See gnome_vfs_mime_application_launch_with_env.)
> So I tried a little shell magic. I created a new wrapper shell script
> that assumes the argument is a path to a file, and
> sets the current directory to the directory containing that file:
> DIR=`dirname "$1"`
> DIR=`cd "$DIR"; pwd`
> cd "$DIR"
> wine "$@"
> That worked better; it let ViewSel.exe launch the DICOM viewer.
> So... I suppose the next step is to look at the debian/ubuntu packages
> for wine and see if that little wrapper script could be incorporated
> into the default way file browsers start wine?
> It sure would be nice if apps that expected the current directory
> to behave like this (it's not uncommon!) Just Worked.
> - Dan
Which version of nautilus (err.. Gnome) were you using? The one in Edgy
I ask, because Edgy seems to not want to run executables at all from
double clicking, producing this horrendous error:
I've been told the above is a bug in nautilus. At any rate, it
partially resulted from removing the MIME contents of Wine from the
packages; this was done for security purposes, and because
binfmt-support is supposed to launch the app with Wine. You'll notice
in the above image that it does indeed identify the application
correctly - nautilus just fails to launch it.
That said, I maintain the Ubuntu packages, and if you've got a fix I can
use, I'll certainly incorporate it.
More information about the wine-devel