mimePaths - multiple declarations

Function mimePaths

Get shared MIME database paths based on dataPaths.

auto auto mimePaths(Range) (
  Range dataPaths
)
if (isInputRange!Range && is(ElementType!Range : string));

Returns

Range of paths where MIME database files are stored.

Example

auto dataPaths = ["share", buildPath("local", "share")];
assert(equal(mimePaths(dataPaths), [buildPath("share", "mime"), buildPath("local", "share", "mime")]));

Function mimePaths

Get shared MIME database paths in system.

auto string[] mimePaths() nothrow @safe;

This function is Freedesktop only.

Note

This function does not check if paths exist and appear to be directories.

Returns

Range of MIME paths in the order of preference from the most preferable to the least. Usually it's the same as $HOME/.local/share/mime, /usr/local/share/mime and /usr/share/mime.

Example

auto dataHomeGuard = EnvGuard("XDG_DATA_HOME");
auto dataDirsGuard = EnvGuard("XDG_DATA_DIRS");

environment["XDG_DATA_HOME"] = "/home/user/data";
environment["XDG_DATA_DIRS"] = "/usr/local/data:/usr/data";

assert(mimePaths() == [
    "/home/user/data/mime", "/usr/local/data/mime", "/usr/data/mime"
]);