<div>&gt; I thought the previous discussions led to the conclusion of rather making this<br>&gt; a separate library from xdgmime? I.e. calling it xdgappcache or something, and<br>&gt; removing all the xdg-mime stuff from it?<br>

&gt; I don&#39;t mind either way personnally, though.<div><font color="#000000"><font><br></font></font></div></div><div><font color="#000000"><font>Yes, you are right. I was working on such feature at the moment of my previous</font></font></div>

<div><font color="#000000"><font>letter. But now it&#39;s done. Also I have renamed the library to xdg (libxdg), because</font></font></div><div><font color="#000000"><font>I think this name better reflects the functional of the library.</font></font></div>

<div><font color="#000000"><font><br></font></font></div><div><font color="#000000"><font>So, here is the changes (&quot;</font></font><a href="https://github.com/ZeR0God/libxdg" style="color:rgb(17,85,204)" target="_blank">https://github.com/ZeR0God/libxdg</a>&quot;, tag &quot;rc-0.1.2&quot;):</div>

<div><font color="#000000"><font> - first of all, now CMake project</font></font> contains 3 targets (xdg, doc and</div><div>update-applications-cache);</div><div> - CMake flag: BUILD_MIME_SPEC (Build library with &quot;Shared MIME-info</div>

<div><font color="#000000"><font><div>Database&quot;);</div><div> - CMake flag: BUILD_DESKTOP_SPEC (Build library with &quot;Desktop Entry</div><div>Specification&quot;);</div><div> - CMake flag: BUILD_THEMES_SPEC (Build library with &quot;Icon Theme</div>

<div>Specification&quot;);</div><div><div> - CMake flag: BUILD_UPDATE_APPLICATIONS_CACHE (Build executable for</div><div>rebuilding the cache). Note: there won&#39;t be target &quot;update-applications-cache&quot; if this</div>

<div>flag is set to false;</div><div> - I&#39;ve created &quot;FindXDG.cmake&quot; script (it will help to find the library with native</div><div>CMake tools, i.e. &quot;find_package&quot;);</div><div><font color="#000000"><font></font></font></div>

 - target &quot;install&quot; is working properly.</div><div><br></div><div>You can choose flags to get the library with exact functional you need.</div></font></font></div><div><div><font color="#000000"><font><br>
</font></font></div><div>&gt; I checked out the code, but for easier thinking, do you have a documentation<br>&gt; of the binary cache data format? This is important for the future anyway<br>&gt; because, just like with mime.cache, there will be other implementations<br>

&gt; reading directly from the cache (rather than linking to libxdgappcache).</div><div><font><font color="#222222" face="arial, sans-serif"><br></font></font></div></div><div><font color="#222222" face="arial, sans-serif"><div>

I will document this format when I will be documenting internal parts of the library.</div><div>I think it will be third or fourth release candidate.</div></font></div><div><font><font color="#222222" face="arial, sans-serif"><br>

</font></font></div><div><div style="color:rgb(80,0,80)"><font>&gt; One thing I noticed: all the data types in the binary cache should have fixed<br>&gt; size. Using &quot;int&quot; or &quot;long&quot; is just recipe for trouble in the long run<br>

&gt; (portability issues).<br></font></div><div><h3 style="line-height:12px;font-family:inherit;font-style:inherit;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;outline-width:0px;outline-style:initial;outline-color:initial;font-weight:inherit;vertical-align:baseline;color:rgb(51,51,51)">

<font><br></font></h3><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>Thanks, I will fix it in the next release candidate.</font></div><div style="color:rgb(80,0,80)">
<div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font> </font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>&gt; The executable is all I need personnally. But shouldn&#39;t there also be a<br>

&gt; library (for reading the cache), and unit tests using that library?<br>&gt; <br>&gt; This is the best way to ensure that the implementation is correct: a binary<br>&gt; for writing the cache, a library and a unit test for reading from it and<br>

&gt; checking that it&#39;s all as expected.<br>&gt; <br>&gt; For parallel with the mime stuff: update-mime-database in shared-mime-info is<br>&gt; the first one, xdgmime is the library and the auto tests in shared-mime-info<br>

&gt; use xdgmime to validate that everything works.<br>&gt; <br>&gt; If &quot;xdgappscache&quot; is made a separate package, it could provide all three,<br>&gt; IMHO.<br></font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px">

<font><br></font></div></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>Yes, it is. As I mentioned above, now CMake project contains target &quot;xdg&quot;.</font></div>

<div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>Unit tests will be added a little bit later.</font></div><div style="color:rgb(80,0,80)"><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px">

<font><br></font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>&gt; That&#39;s cool - they are in the cache too?</font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px">

<font><br></font></div></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>Yes, cache contains all data from &quot;.desktop&quot; and &quot;.list&quot; files (and all this</font></div>

<div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>stuff </font>is indexed by using of AVL trees which means the fastest possible</div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px">

access to this data).</div><div style="color:rgb(80,0,80)"><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font><br></font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px">

<font>&gt; Missing feature: taking a path on the command line, to generate the cache for<br>&gt; that path (rather than for /usr/share/applications). Again, much like update-<br>&gt; mime-info :-)<br></font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px">

<font><br></font></div></div><div><font color="#222222" face="arial, sans-serif">:) Yep, you&#39;re right again. I&#39;m planning to do so for the next release candidate.</font></div><div style="color:rgb(80,0,80)">
<div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font><br></font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font>&gt; This is necessary in order to allow local desktop files too (e.g.<br>

&gt; ~/.local/share/applications). And the lib has to read from all xdg data dirs<br>&gt; of course.</font></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px"><font><br></font></div>

</div></div></div><div class="gmail_quote"><span>Yes, lib does and I will fix the cache for the next release candidate.</span></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px;background-color:rgb(255,255,255)">
<h3 style="font-family:inherit;font-style:inherit;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;outline-width:0px;outline-style:initial;outline-color:initial;font-weight:inherit;vertical-align:baseline;color:rgb(51,51,51)">
<font>--------------------------------</font></h3></div><div style="font-family:Arial,Helvetica,&#39;Nimbus Sans L&#39;,sans-serif;line-height:12px;background-color:rgb(255,255,255)"><h3 style="font-family:inherit;font-style:inherit;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;outline-width:0px;outline-style:initial;outline-color:initial;font-weight:inherit;vertical-align:baseline;color:rgb(51,51,51)">
<font>Best regards, Dmitriy.</font></h3><div><font><br></font></div></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">
19 февраля 2012 г. 14:39 пользователь David Faure <span dir="ltr">&lt;<a href="mailto:faure@kde.org" target="_blank">faure@kde.org</a>&gt;</span> написал:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>On Friday 17 February 2012 13:38:34 DAV wrote:<br>
&gt; Hi all,<br>
&gt; I&#39;m glad to announce the first release candidate of &quot;exdgmime&quot; library.<br>
<br>
</div>I thought the previous discussions led to the conclusion of rather making this<br>
a separate library from xdgmime? I.e. calling it xdgappcache or something, and<br>
removing all the xdg-mime stuff from it?<br>
I don&#39;t mind either way personnally, though.<br>
<div><br>
&gt; So, here is the changes:<br>
&gt;<br>
&gt;  - serialization/deserialization of content of &quot;.desktop&quot; and<br>
&gt; &quot;.list&quot; files (with indexes) into a binary cache file which can be mmap&#39;ed<br>
&gt; without need to rescan whole system directories. Reading of this cache<br>
&gt; file is done without a single allocation of memory (just update pointers<br>
&gt; in mmap&#39;ed memory);<br>
<br>
</div>I checked out the code, but for easier thinking, do you have a documentation<br>
of the binary cache data format? This is important for the future anyway<br>
because, just like with mime.cache, there will be other implementations<br>
reading directly from the cache (rather than linking to libxdgappcache).<br>
<br>
One thing I noticed: all the data types in the binary cache should have fixed<br>
size. Using &quot;int&quot; or &quot;long&quot; is just recipe for trouble in the long run<br>
(portability issues).<br>
<br>
int read_version(void **memory)<br>
{<br>
        int version = (*(int *)(*memory));<br>
<br>
        (*memory) += sizeof(int);<br>
<br>
        return version;<br>
}<br>
<br>
The mime.cache format is all made from &quot;card16&quot;, &quot;card32&quot; and strings.<br>
<div><br>
&gt;  - a cmake project configuration file which contains two targets:<br>
&gt; &quot;update-applications-cache&quot; (it is executable which rebuilds the cache) and<br>
&gt; &quot;doc&quot; (generates Doxygen documentation);<br>
<br>
</div>The executable is all I need personnally. But shouldn&#39;t there also be a<br>
library (for reading the cache), and unit tests using that library?<br>
<br>
This is the best way to ensure that the implementation is correct: a binary<br>
for writing the cache, a library and a unit test for reading from it and<br>
checking that it&#39;s all as expected.<br>
<br>
For parallel with the mime stuff: update-mime-database in shared-mime-info is<br>
the first one, xdgmime is the library and the auto tests in shared-mime-info<br>
use xdgmime to validate that everything works.<br>
<br>
If &quot;xdgappscache&quot; is made a separate package, it could provide all three,<br>
IMHO.<br>
<div><br>
&gt;  - a convinient access to localized values of entries of a &quot;.desktop&quot; files.<br>
<br>
</div>That&#39;s cool - they are in the cache too?<br>
<br>
That&#39;s something I really miss in mime.cache, for easier deployment (I&#39;d like<br>
to only deploy the cache, on systems without shared-mime-info installed).<br>
<br>
Thinking about it, it&#39;s less important with desktop files. We can just open the<br>
desktop file to read the translated comment, the point of the app cache is<br>
really the querying by mimetype... but OK if it&#39;s available, that certainly<br>
makes things faster.<br>
<br>
<br>
Missing feature: taking a path on the command line, to generate the cache for<br>
that path (rather than for /usr/share/applications). Again, much like update-<br>
mime-info :-)<br>
This is necessary in order to allow local desktop files too (e.g.<br>
~/.local/share/applications). And the lib has to read from all xdg data dirs<br>
of course.<br>
<span><font color="#888888"><br>
--<br>
David Faure, <a href="mailto:faure@kde.org" target="_blank">faure@kde.org</a>, <a href="http://www.davidfaure.fr" target="_blank">http://www.davidfaure.fr</a><br>
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5<br>
<br>
</font></span></blockquote></div><br>