findKnownAssociatedApplications

Find all known associated applications for given MIME type, including explicitly removed by user.

const(DesktopFile)[]
findKnownAssociatedApplications
(
ListRange
CacheRange
)
if (
isForwardRange!ListRange &&
is(ElementType!ListRange : const(MimeAppsListFile))
&&
isForwardRange!CacheRange
&&
is(ElementType!CacheRange : const(MimeInfoCacheFile))
)

Parameters

mimeType string

MIME type or uri scheme handler in question.

mimeAppsListFiles ListRange

Range of MimeAppsListFile objects to use in searching.

mimeInfoCacheFiles CacheRange

Range of MimeInfoCacheFile objects to use in searching.

desktopFileProvider IDesktopFileProvider

Desktop file provider instance. Must be non-null.

Return Value

Type: const(DesktopFile)[]

Array of found desktopfile.file.DesktopFile objects capable of opening file of given MIME type or url of given scheme.

Examples

auto desktopProvider = new DesktopFileProvider(["test/applications"]);
auto mimeAppsList = new MimeAppsListFile("test/applications/mimeapps.list");
auto mimeInfoCache = new MimeInfoCacheFile("test/applications/mimeinfo.cache");
assert(findKnownAssociatedApplications("text/plain", [null, mimeAppsList], [null, mimeInfoCache], desktopProvider)
    .map!(d => d.displayName()).equal(["Geany", "Kate", "Emacs", "Okular"]));

See Also

Meta