exdgmime

David Faure faure at kde.org
Sun Feb 19 02:39:31 PST 2012


On Friday 17 February 2012 13:38:34 DAV wrote:
> Hi all,
> I'm glad to announce the first release candidate of "exdgmime" library.

I thought the previous discussions led to the conclusion of rather making this 
a separate library from xdgmime? I.e. calling it xdgappcache or something, and 
removing all the xdg-mime stuff from it?
I don't mind either way personnally, though.

> So, here is the changes:
> 
>  - serialization/deserialization of content of ".desktop" and
> ".list" files (with indexes) into a binary cache file which can be mmap'ed
> without need to rescan whole system directories. Reading of this cache
> file is done without a single allocation of memory (just update pointers
> in mmap'ed memory);

I checked out the code, but for easier thinking, do you have a documentation 
of the binary cache data format? This is important for the future anyway 
because, just like with mime.cache, there will be other implementations 
reading directly from the cache (rather than linking to libxdgappcache).

One thing I noticed: all the data types in the binary cache should have fixed 
size. Using "int" or "long" is just recipe for trouble in the long run 
(portability issues).

int read_version(void **memory)
{
        int version = (*(int *)(*memory));

        (*memory) += sizeof(int);

        return version;
}

The mime.cache format is all made from "card16", "card32" and strings.
 
>  - a cmake project configuration file which contains two targets:
> "update-applications-cache" (it is executable which rebuilds the cache) and
> "doc" (generates Doxygen documentation);

The executable is all I need personnally. But shouldn't there also be a 
library (for reading the cache), and unit tests using that library?

This is the best way to ensure that the implementation is correct: a binary 
for writing the cache, a library and a unit test for reading from it and 
checking that it's all as expected.

For parallel with the mime stuff: update-mime-database in shared-mime-info is 
the first one, xdgmime is the library and the auto tests in shared-mime-info 
use xdgmime to validate that everything works.

If "xdgappscache" is made a separate package, it could provide all three, 
IMHO.

>  - a convinient access to localized values of entries of a ".desktop" files.

That's cool - they are in the cache too?

That's something I really miss in mime.cache, for easier deployment (I'd like 
to only deploy the cache, on systems without shared-mime-info installed).

Thinking about it, it's less important with desktop files. We can just open the 
desktop file to read the translated comment, the point of the app cache is 
really the querying by mimetype... but OK if it's available, that certainly 
makes things faster.


Missing feature: taking a path on the command line, to generate the cache for 
that path (rather than for /usr/share/applications). Again, much like update-
mime-info :-)
This is necessary in order to allow local desktop files too (e.g. 
~/.local/share/applications). And the lib has to read from all xdg data dirs 
of course.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5



More information about the xdg mailing list