[haiku-development] Re: Separation of application configuration, data and cache

  • From: "Christoph .J Thompson" <cjsthompson@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 11 Nov 2009 12:54:51 +0100

François Revol wrote:
>Actually I didn't think we had one yet, but I just checked and found 
>B_USER_CACHE_DIRECTORY in :
>http://dev.haiku-os.org/browser/haiku/trunk/headers/os/storage/FindDirectory.h
>
>So just use it ;-)

Isn't it just great to find out that everything was carefully thought out
beforehand :)

scottmc wrote:
>I have just added this as a task ticket on HaikuPorts:
>http://ports.haiku-files.org/ticket/250
>Seems it's just a simple task of mapping of xdg dirs to find_directory
>dirs, but that's just at first glance, a deeper reading of the spec
>and code should be studied first just to be sure.

I think it's a little bit more complicated because with XDG you can
override the default directories with environment variables.

Axel Dörfler wrote:
>I haven't seen that yet, but it's surely an appreciated step. If 
>application will follow this, porting them to Haiku properly will be 
>easier, too.

Looking at ~/.config (the standard place on Linux where the configuration is
stored according to this XDG standard) I can find only Gtk/Xfce applications
right now. I guess that SDL and console apps are more interresting to Haiku
than Gtk apps. Unfortunately, I doubt there is something as nice as
find_directory() in glibc and/or SDL. So my idea would be to provide functions
that use either the XDG standard or find_directory directly in SDL. And
for console apps write simple C and C++ files that would be using also either
XDG or find_directory() depending if it was compiled for BSD/Linux or
Haiku. These files could be conditionally compiled-in, and a patch would be
sent upstream to fix the issue directly. In the end both Haiku and Linux/BSD
win.

For console apps, since Linux/BSD seemingly doesn't have anything like
find_directory(), maybe I could just create a function also called
find_directory() with the Be semantics in a standalone C file/header
but that would use XDG as it's backend. That way when a console app
is compiled on Haiku it would just use directly the find_directory()
in libroot. And when compiled on Linux/BSD it would use the
find_directory() provided in the extra C file/header. However I don't
how people would react to this.

I'd appreciate your advice on this.

Thanks for your time,

-- 
PGP: 0xC189F229

Other related posts: