New version of xdg-user-dirs

Alexander Larsson alexl at redhat.com
Mon Feb 26 00:59:26 PST 2007


On Fri, 2007-02-23 at 12:49 -0500, William Jon McCann wrote:
> On 2/23/07, Alexander Larsson <alexl at redhat.com> wrote:
> > On Fri, 2007-02-23 at 11:47 -0500, William Jon McCann wrote:
> > > will be used after login but is that expected?  If it is expected then
> > > xdg-user-dir-lookup suffers the same problem in a lesser form unless
> > > the files are monitored for changes, right?
> >
> > Yes, i expect them to be able to change after login. "Make this my
> > default directory for pictures" kind of thing.
> >
> > xdg-user-dir-lookup is ok, because it doesn't do any form of caching.
> > But a less naive version would need monitoring or mtime checking.
> 
> Ok, just trying to clarify.  In practice, the caching would be done by
> the application.  So the application would need to respond to some
> kind of "user-directory-location-changed" signal from somewhere,
> right?

It doesn't need to be an external source. Its very easy to stat() the
file and look at mtime to avoid rereading it if there are no changes.
Additionally one can limit such stat lookups by rate-limiting with
gettimeofday to say, max one stat each 2 seconds or something like that.

It all depends on what you need things for. If you just want to pick a
default directory when you open a file selector you don't really need to
be especially clever. Whereas for nautilus that might be displaying a
list of common directories we'd like to update as soon as the setting
changes we'd need something more clever such as fam/gamin/inotify.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's an unconventional day-dreaming farmboy on the edge. She's an orphaned 
African-American single mother trying to make a difference in a man's world. 
They fight crime! 




More information about the xdg mailing list