well-known user folders in a distributed environment

Dieter Plaetinck dieter at plaetinck.be
Sun May 4 04:05:40 PDT 2008


Hi all,

I really like the idea the idea of having 'well-known user folders' 
specified like discussed on this list.
I see some distributions (well, at least ubuntu) implement this already.
(the ~/.config/user-dirs.dirs is supposed to be sourced/parsed by 
applications right, so the variables don't need to be set in the 
environment?)
On the other hand I couldn't find any released spec on this (yet).  I 
see no mention of XDG_MUSIC_DIR or XDG_PICTURES_DIR for example on 
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html .  
Was I looking in the wrong place or are distro's already implementing 
this without a spec?


But anyway, here is a conceptual issue I'm having:
Usually a user does not use one machine, but more.  A common example 
would be a user having a laptop and a machine at home.
Often the user would have a big music collection on his home box, 
mounted through nfs/smb when at home.  For on the road, the user 
probably has a smaller subset of his music collection (his favorite 
songs) copied into another folder.  In some aspects similar, in other 
quite different would be the pictures folder: when on the road the user 
could make pictures and put these in a 'temporary folder', when at home 
the user usually copies these new images to his storage server where all 
his pictures are stored.  For the other folders we can think of similar 
habits.

I haven't figured out yet whether I think the basedir spec should be 
geared towards such behavior per se, but I think it should be at least 
'compatible' with it.

Assume for example the user has 2 folders somewhere in ~:
music-collection (mountpoint for nfs share when at home)
music-favorite (subset of tracks, copied locally)

Here are 3 different approaches:
- allow the user to change the variables in ~/.config/user-dirs.dirs 
during the login-session.  Like this the user could update XDG_MUSIC_DIR 
to point to the directory he wants (depending on where he is).  This 
solution requires changes to applications: they would have to re-parse 
the config file over and over again, or be notified of changes through 
signals (eg USR1) or dbus. Or for 'legacy' applications the user would 
need to restart them when he wants to change the config.

- the user could make the directory pointed by XDG_MUSIC_DIR a symlink 
and change it to point to the other dirs.  This would be more friendly 
to applications although they can still get confused (if they cache the 
symlink).  Also the user might get data corruption if he changes the 
symlink while an application is writing to the target. Something to 
avoid definitely...

- the third option is least intrusive.  If i understand correctly the 
spec will only be about the directories themselves and not about their 
contents.  So there is no spec (yet) telling the user how to organize 
the contents of his music folder for example. (Actually I think 
standardizing this would also be a good thing. especially for picture 
folders & image editors: where to store the originals that will never be 
altered, where to stored modified/resized etc images, and so on.  But 
this is an entirely other topic)
In this case the user could put this music-collection and music-favorite 
folders inside his XDG_MUSIC_DIR.  This is very transparent with the 
current method.  Although if a user wants to save/load a song his 
application would point him to the XDG_MUSIC_DIR and the user would need 
to select manually the right subdirectory in that, whereas in the 
solutions above this is not needed.

Let me know what you think...
Dieter


More information about the xdg mailing list