DesktopFile.id

  1. string id()
    class DesktopFile
    @safe
    string
    id
    const nothrow
    (
    )
  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

1 import desktopfile.paths;
2 
3 string contents = "[Desktop Entry]\nType=Directory";
4 auto df = new DesktopFile(iniLikeStringReader(contents), "/home/user/data/applications/test/example.desktop");
5 auto dataHomeGuard = EnvGuard("XDG_DATA_HOME", "/home/user/data");
6 assert(df.id() == "test-example.desktop");

See Also

desktopfile.paths.applicationsPaths, desktopfile.utils.desktopId

Meta