Legacy Menu Hierarchies

Traditionally, menus were defined as a filesystem hierarchy, with each filesystem directory corresponding to a submenu. Implementations of this specification must be able to load these old-style hierarchies as specified in this section.

The general approach is: the legacy hierarchy is converted into a <Menu>, and then this menu layout is merged with the menu that specified <LegacyDir>.

Desktop entries in the legacy hierarchy should be added to the pool of desktop entries as if the <LegacyDir> were an <AppDir>. Directory entries in the legacy hierarchy should be added to the pool of directory entries as if the <LegacyDir> were a <DirectoryDir>. This can be trivially implemented by adding appropriate <AppDir> and <DirectoryDir> statements to the root legacy <Menu>. There is one slight complexity, namely the "prefix" attribute of <LegacyDir>.

The menu layout corresponds conceptually to the following, though actually generating the XML is not necessary:

For example, say we have the following legacy directory hierarchy:

          /usr/share/applnk
              /usr/share/applnk/.directory
              /usr/share/applnk/bar.desktop
              /usr/share/applnk/System
                  /usr/share/applnk/System/.directory
                  /usr/share/applnk/System/foo.desktop
        

Conceptually that is converted to the following <Menu>:

          <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 0.8//EN"
          "http://www.freedesktop.org/standards/menu-spec/menu-0.8.dtd">

          <Menu>
            <Name>Applications</Name>
            <AppDir>/usr/share/applnk</AppDir>
            <DirectoryDir>/usr/share/applnk</DirectoryDir>
            <Directory>.directory</Directory>
            <Include>
              <Filename>bar.desktop</Filename>
            </Include>
            <Menu>
              <Name>System</Name>
              <AppDir>/usr/share/applnk/System</AppDir>
              <DirectoryDir>/usr/share/applnk/System</DirectoryDir>
              <Directory>.directory</Directory>
              <Include>
                <Filename>foo.desktop</Filename>
              </Include>
            </Menu>
          </Menu>
        

This <Menu> is then merged as if it were in a file and loaded with <MergeFile>.