Comment 0 for bug 999427

Revision history for this message
Gary Lasker (gary-lasker) wrote :

While investigating bug 925014, I made the discovery that Unity launcher items that are added during an application installation via the Ubuntu Software Center incorrectly point to the desktop files from the app-install-data package, in the directory:

  /usr/share/app-install/desktop (e.g., /usr/share/app-install/desktop/gnome-hearts:gnome-hearts.desktop

rather than the actual *installed* desktop files in:

  /usr/share/applications (e.g., /usr/share/applications/gnome-hearts.desktop)

Note that the installed desktop files can be found in the /usr/share/applications directory after the installation has completed.

This appears to be a regression in a very recent release of Unity, as afaik this has worked correctly for quite a few cycles and also in Precise right up until the very final releases.

Note that we recently finished the remaining pieces of the implementation of the fully animated Unity launcher integration, as outlined in bug 761851, and it was as part of this work that this regression appears to have occurred.

You can refer to comment #7 of bug 761851 for details about the steps needed to determine the actual installed desktop file path. The Python code from Software Center that we used in past releases for this is as shown:

    def convert_desktop_file_to_installed_location(app_install_data_file_path, pkgname=None):
    """ returns the installed desktop file path that corresponds to the
        given app-install-data file path, and will also check directly for
        the desktop file that corresponds to a given pkgname.
    """
    # "normal" case
    installed_desktop_file_path = app_install_data_file_path.replace("app-install/desktop", "applications")
    if os.path.exists(installed_desktop_file_path):
        return installed_desktop_file_path
    # next, try case where a subdirectory is encoded in the app-install
    # desktop filename, e.g. kde4_soundkonverter.desktop
    installed_desktop_file_path = installed_desktop_file_path.replace(APP_INSTALL_PATH_DELIMITER, "/")
    if os.path.exists(installed_desktop_file_path):
        return installed_desktop_file_path
    # lastly, just try checking directly for the desktop file based on the pkgname itself
    if pkgname:
        installed_desktop_file_path = "/usr/share/applications/%s.desktop" % pkgname
        if os.path.exists(installed_desktop_file_path):
            return installed_desktop_file_path
    logging.warn("Could not determine the installed desktop file path for app-install desktop file: '%s'" % app_install_data_file_path)
    return ""