DesktopFile.id

  1. string id()
    class DesktopFile
    @safe const nothrow
    static if(isFreedesktop)
    string
    id
    ()
  2. string id(Range appPaths)

Return Value

Type: string

Desktop file ID or empty string if file does not have an ID. Note: This function retrieves applications paths each time it's called and therefore can impact performance. To avoid this issue use overload with argument.

Examples

import desktopfile.paths;

string contents = "[Desktop Entry]\nType=Directory";
auto df = new DesktopFile(iniLikeStringReader(contents), "/home/user/data/applications/test/example.desktop");
auto dataHomeGuard = EnvGuard("XDG_DATA_HOME", "/home/user/data");
assert(df.id() == "test-example.desktop");

See Also

desktopfile.paths.applicationsPaths, desktopfile.utils.desktopId

Meta