[Pidgin] #10029: Support XDG dir structure

Pidgin trac at pidgin.im
Mon Mar 5 23:31:20 EST 2018


#10029: Support XDG dir structure
-----------------------+------------------------
 Reporter:  salinasv   |       Owner:  EionRobb
     Type:  task       |      Status:  closed
Milestone:  3.0.0      |   Component:  libpurple
  Version:             |  Resolution:  fixed
 Keywords:  XDG 3.0.0  |
-----------------------+------------------------

Comment (by sergem):

 Replying to [comment:27 qarkai]:
 > Any comments on previous reply? Proper reading of XDG and FHS specs?

 Ah, sure, but the comments would be rather long...


 Replying to [comment:21 qarkai]:
 > It looks like GNOME patched a lot of their apps:
 https://wiki.gnome.org/Initiatives/GnomeGoals/XDGConfigFolders

 ~~(Many people believe that
 [https://en.wikipedia.org/wiki/Modern_flat_Earth_societies Earth is flat],
 but that doesn't really change Earth's shape.)~~ Yes, I know that the idea
 to scatter files to 3 directories instead of 1 is somewhat popular, but
 that doesn't make it any better. It still makes backup/restore and
 regression testing harder, and still provides no benefits. Even the
 article you linked lists no benefits, just the guidelines how to do it.


 > "$XDG_CONFIG_HOME defines the base directory relative to which user
 specific configuration files should be stored. If $XDG_CONFIG_HOME is
 either not set or empty, a default equal to $HOME/.config should be used."
 $XDG_CONFIG_DIRS according to basedir-spec is an addition to the
 $XDG_CONFIG_HOME.

 Yes, that's exactly what I'm talking about! XDG_CONFIG_DIRS is used
 together with XDG_CONFIG_HOME.  Basically, if you're reading applications
 menu, you must read it from XDG_CONFIG_HOME, and if it's not there, you
 must read if from XDG_CONFIG_DIRS, i.e. /etc/xdg/, and if it's not there
 either, you must assume some sane default. So if you use _HOME, you must
 use _DIRS too.


 > There is another opinion:
 > https://ploum.net/184-cleaning-user-preferences-keeping-user-data/
 > https://ploum.net/207-modify-your-application-to-use-xdg-folders/

 Heh. It was supposed to provide some separation between "config" and
 "data". But it did not. "If you can reconfigure it - it's a config" is not
 enough. Imagine that you've lost your contact list. If it was a jabber
 contact list, it can be downloaded again from the server, which makes it a
 "cache". If it was an IRC contact list with just 2 contacts in it, you can
 add both contacts manually, which makes it a "config". But if you had 150
 IRC contacts in there and you've lost your entire contact list, you "would
 cry, running frenetically to your backup" which makes it "data". Same
 applies to other settings, if I lost just one or two, and I remember what
 they were, I can reconfigure them easily, but if I lost my 436 settings
 that I configured during last 10 years — I'd better restore a backup
 instead of trying to figure out each of them again.

 Also that "another opinion" is just another way to abuse XDG standard
 dirs, nothing in the standard itself support it. And it's not why XDG
 defined two dirs. XDG standard created two separate directories .config
 and .local because... there were two directories to mirror: /etc and /usr.
 XDG defines .local/share/ as a writeable copy of /usr/share/. E.g.
 [https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-
 latest.html icon-theme-spec] and [https://standards.freedesktop.org
 /desktop-entry-spec/desktop-entry-spec-latest.html desktop-entry-spec] say
 that icons should be in /usr/share/icons/ and app shortcuts should be in
 /usr/share/applications/. But user can't write there if he wants to add
 menu entry or change icon. So standard invented a local writeable copy,
 called it ".local" and defined mapping: /usr/share/icons ->
 .local/share/icons, /usr/share/applications -> .local/share/applications,
 etc. It defines no other directories in .local, because ... it needed no
 other directories.

 So if you really follow XDG with that, i.e. ~/.config/ == /etc/xdg/ and
 ~/.local/ == /usr/ then pidgin should put nothing into .config, as it puts
 nothing into /etc/xdg. But it should read its plugins from
 .local/lib/pidgin (notice .local/lib, not .local/share) (or
 .local/lib/i386-linux-gnu/pidgin depending on OS/distro). And all other
 files should be kept in .purple. :)

 When you read wikipedia, you may have seen a "References" section at the
 end of each page, explaining or linking details to individual words in the
 page. That's what XDG's basedir-spec is. XDG's people just turned it into
 a separate document, so that they don't have to copy-paste same
 XDG_CONFIG_DIRS and XDG_DATA_DIRS definition into every other standard.
 And that's why it only defines .local/share and no other dirs — XDG
 standards needed nothing but /usr/share.

 TL;DR: XDG basedir-spec is just a references list for icons, file
 shortcuts and associations, defined in other XDG standards. It won't help
 you to solve your problems. What was the problem by the way?

--
Ticket URL: <https://developer.pidgin.im/ticket/10029#comment:28>
Pidgin <https://pidgin.im>
Pidgin


More information about the Tracker mailing list