Read MIME Cache from file.
Constructs MimeInfoCacheFile with empty MIME Cache group.
Read MIME Cache from inilike.range.IniLikeReader, e.g. acquired from inilike.range.iniLikeFileReader or inilike.range.iniLikeStringReader.
Alias for easy access to "MIME Cache" group.
Access "MIME Cache" group.
string content = `[Some group] Key=Value `; assertThrown!IniLikeReadException(new MimeInfoCacheFile(iniLikeStringReader(content))); content = `[MIME Cache] text/plain=geany.desktop;kde4-kwrite.desktop; image/png=kde4-gwenview.desktop;gthumb.desktop; `; auto mimeInfoCache = new MimeInfoCacheFile(iniLikeStringReader(content)); assert(mimeInfoCache.appsForMimeType("text/plain").equal(["geany.desktop", "kde4-kwrite.desktop"])); assert(mimeInfoCache.appsForMimeType("image/png").equal(["kde4-gwenview.desktop", "gthumb.desktop"])); assert(mimeInfoCache.appsForMimeType("application/nonexistent").empty); content = `[MIME Cache] text/plain=geany.desktop; notmimetype=value `; assertThrown!IniLikeReadException(new MimeInfoCacheFile(iniLikeStringReader(content))); assertNotThrown(mimeInfoCache = new MimeInfoCacheFile(iniLikeStringReader(content), null, IniLikeFile.ReadOptions(IniLikeGroup.InvalidKeyPolicy.save))); assert(mimeInfoCache.mimeCache.escapedValue("notmimetype") == "value");
Class represenation of single mimeinfo.cache file containing information about MIME type associations. Note: Unlike MimeAppsListFile this class does not provide functions for associations update. This is because mimeinfo.cache files should be updated by update-desktop-database utility from desktop-file-utils.