Re: GAppInfo and the working directory



On Wed, 2010-01-27 at 19:25 +0100, Jannis Pohlmann wrote:
> Hey,
> 
> I've found little information on how to set the working directory for
> applications started via GAppInfo on the net. The only mail I stumbled
> across was this one:
> 
>   http://mail.gnome.org/archives/gtk-list/2008-October/msg00041.html
> 
> It says there are no plans at all to support modifying the working
> directory through GAppLaunchContext because the result of the
> launch operation is unpredictable due of the variety of ways to spawn
> applications (fork, exec, D-Bus, crazy Windows stuff).

Its not just the "protocol" used to spawn. Its also the fact that
launching may not start a new application but rather activate some
existing one, and in that case its not really a good idea to change the
current directory of the running process.

> Alex, if you happen to read this: How does Nautilus do it? (Yes, I
> admit, I'm too lazy to browse the source right now. ;))

We just chdir to the directory and then back after launching. This
obviously doesn't work if an app is using some form of unique app
system, but works for some apps. It sort of helps that nautilus isn't as
portable as e.g. gio, so it can just rely on unix stuff.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl redhat com            alexander larsson gmail com 
He's an uncontrollable guerilla waffle chef haunted by memories of 'Nam. She's 
a strong-willed impetuous nun who hides her beauty behind a pair of 
thick-framed spectacles. They fight crime! 

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]